Commit b38569e6 authored by Benjamin Peterson's avatar Benjamin Peterson

convert to print function

parent 4dd3f607
...@@ -30,7 +30,7 @@ produces either the sum or the max:: ...@@ -30,7 +30,7 @@ produces either the sum or the max::
help='sum the integers (default: find the max)') help='sum the integers (default: find the max)')
args = parser.parse_args() args = parser.parse_args()
print args.accumulate(args.integers) print(args.accumulate(args.integers))
Assuming the Python code above is saved into a file called ``prog.py``, it can Assuming the Python code above is saved into a file called ``prog.py``, it can
be run at the command line and provides useful help messages:: be run at the command line and provides useful help messages::
...@@ -698,7 +698,7 @@ An example of a custom action:: ...@@ -698,7 +698,7 @@ An example of a custom action::
>>> class FooAction(argparse.Action): >>> class FooAction(argparse.Action):
... def __call__(self, parser, namespace, values, option_string=None): ... def __call__(self, parser, namespace, values, option_string=None):
... print '%r %r %r' % (namespace, values, option_string) ... print('%r %r %r' % (namespace, values, option_string))
... setattr(namespace, self.dest, values) ... setattr(namespace, self.dest, values)
... ...
>>> parser = argparse.ArgumentParser() >>> parser = argparse.ArgumentParser()
...@@ -1413,10 +1413,10 @@ Sub-commands ...@@ -1413,10 +1413,10 @@ Sub-commands
>>> # sub-command functions >>> # sub-command functions
>>> def foo(args): >>> def foo(args):
... print args.x * args.y ... print(args.x * args.y)
... ...
>>> def bar(args): >>> def bar(args):
... print '((%s))' % args.z ... print('((%s))' % args.z)
... ...
>>> # create the top-level parser >>> # create the top-level parser
>>> parser = argparse.ArgumentParser() >>> parser = argparse.ArgumentParser()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment