[docs] documentation error/bug 7.1. Fancier Output Formatting

Dan Orton d.orton5963 at gmail.com
Mon Mar 7 03:18:32 CET 2011


hello,

I think I may have found a bug in the documentation under 7.1. Fancier
Output Formatting<http://docs.python.org/tutorial/inputoutput.html#fancier-output-formatting>

as I am a beginner, I really do not have many ideas on how to fix it.

also as this is a simpleton error, there may already be discussion on a fix.

*1)* You will see the following code.

>>> import math>>> print 'The value of PI is approximately {}.'.format(math.pi)The value of PI is approximately 3.14159265359.>>> print 'The value of PI is approximately {!r}.'.format(math.pi)The value of PI is approximately 3.141592653589793.

*2) *
When entered into Python, it complains

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> print 'The value of PI is approximately {}.'.format(math.pi)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: zero length field name in format
>>> print 'The value of PI is approximately {!r}.'.format(math.pi)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: zero length field name in format
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110307/03a7478c/attachment-0001.html>


More information about the docs mailing list