[Python-checkins] r65253 - python/trunk/Doc/tutorial/inputoutput.rst

Raymond Hettinger python at rcn.com
Sun Jul 27 03:38:38 CEST 2008


Since the examples all run at the interactive prompt,
the print-function can be dropped.  This will shorten
the lines a bit and keep the emphasis on the interesting part.


----- Original Message ----- 
From: "georg.brandl" <python-checkins at python.org>
To: <python-checkins at python.org>
Sent: Saturday, July 26, 2008 3:13 PM
Subject: [Python-checkins] r65253 - python/trunk/Doc/tutorial/inputoutput.rst


> Author: georg.brandl
> Date: Sun Jul 27 00:13:29 2008
> New Revision: 65253
> 
> Log:
> Shorten some overlong lines.
> 
> 
> Modified:
>   python/trunk/Doc/tutorial/inputoutput.rst
> 
> Modified: python/trunk/Doc/tutorial/inputoutput.rst
> ==============================================================================
> --- python/trunk/Doc/tutorial/inputoutput.rst (original)
> +++ python/trunk/Doc/tutorial/inputoutput.rst Sun Jul 27 00:13:29 2008
> @@ -143,12 +143,14 @@
> If keyword arguments are used in the format method, their values are referred to
> by using the name of the argument. ::
> 
> -   >>> print 'This {food} is {adjective}.'.format(food='spam', adjective='absolutely horrible')
> +   >>> print 'This {food} is {adjective}.'.format(
> +   ...       food='spam', adjective='absolutely horrible')
>    This spam is absolutely horrible.
> 
> Positional and keyword arguments can be arbitrarily combined::
> 
> -   >>> print 'The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred', other='Georg')
> +   >>> print 'The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',
> +   ...                                                    other='Georg')
>    The story of Bill, Manfred, and Georg.
> 
> An optional ``':``` and format specifier can follow the field name. This also
> @@ -176,7 +178,8 @@
> square brackets ``'[]'`` to access the keys ::
> 
>    >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
> -   >>> print 'Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table)
> +   >>> print ('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
> +   ...        'Dcab: {0[Dcab]:d}'.format(table))
>    Jack: 4098; Sjoerd: 4127; Dcab: 8637678
> 
> This could also be done by passing the table as keyword arguments with the '**'
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins


More information about the Python-checkins mailing list