Skip to content

Commit ddd33a0

Browse files
authored
Merge pull request #298 from python-cmd2/poutput_instead_of_print
Use self.poutput() instead of print() in arg_print.py example
2 parents 2af4473 + 92c5088 commit ddd33a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/arg_print.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def __init__(self):
3434

3535
def do_aprint(self, arg):
3636
"""Print the argument string this basic command is called with."""
37-
print('aprint was called with argument: {!r}'.format(arg))
37+
self.poutput('aprint was called with argument: {!r}'.format(arg))
3838

3939
@with_argument_list
4040
def do_lprint(self, arglist):
4141
"""Print the argument list this basic command is called with."""
42-
print('lprint was called with the following list of arguments: {!r}'.format(arglist))
42+
self.poutput('lprint was called with the following list of arguments: {!r}'.format(arglist))
4343

4444
oprint_parser = argparse.ArgumentParser()
4545
oprint_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
@@ -50,7 +50,7 @@ def do_lprint(self, arglist):
5050
@with_argparser(oprint_parser)
5151
def do_oprint(self, args):
5252
"""Print the options and argument list this options command was called with."""
53-
print('oprint was called with the following\n\toptions: {!r}'.format(args))
53+
self.poutput('oprint was called with the following\n\toptions: {!r}'.format(args))
5454

5555
pprint_parser = argparse.ArgumentParser()
5656
pprint_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
@@ -59,7 +59,7 @@ def do_oprint(self, args):
5959
@with_argparser_and_unknown_args(pprint_parser)
6060
def do_pprint(self, args, unknown):
6161
"""Print the options and argument list this options command was called with."""
62-
print('oprint was called with the following\n\toptions: {!r}\n\targuments: {}'.format(args, unknown))
62+
self.poutput('oprint was called with the following\n\toptions: {!r}\n\targuments: {}'.format(args, unknown))
6363

6464

6565

0 commit comments

Comments
 (0)