<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19120">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Dear Python Team.</FONT></DIV>
<DIV><FONT size=2 face=Arial>I am part way through the Python Tutorial v2.7.2
and have found one difficulty which I think is worth reporting as
follows:</FONT></DIV>
<DIV>Section = 7.1. Fancier Output Formatting</DIV>
<DIV>Copy of tutorial original content (which does not work giving an error
message with last line : </DIV>
<DIV>"ValueError: zero length field name in format" ) :</DIV>
<DIV>
<P><TT class="docutils literal"><SPAN class=pre>'!s'</SPAN></TT> (apply <A
class="reference external" title=str
href="http://docs.python.org/library/functions.html#str"><TT
class="xref docutils literal"><SPAN class=pre>str()</SPAN></TT></A>) and <TT
class="docutils literal"><SPAN class=pre>'!r'</SPAN></TT> (apply <A
class="reference external" title=repr
href="http://docs.python.org/library/functions.html#repr"><TT
class="xref docutils literal"><SPAN class=pre>repr()</SPAN></TT></A>) can be
used to convert the value before it is formatted.</P>
<P><SPAN class=gp>>>> </SPAN><SPAN class=kn>import</SPAN> <SPAN
class=nn>math</SPAN><BR><SPAN class=gp>>>> </SPAN><SPAN
class=k>print</SPAN> <SPAN class=s>'The value of PI is approximately
{}.'</SPAN><SPAN class=o>.</SPAN><SPAN class=n>format</SPAN><SPAN
class=p>(</SPAN><SPAN class=n>math</SPAN><SPAN class=o>.</SPAN><SPAN
class=n>pi</SPAN><SPAN class=p>)</SPAN><BR><SPAN class=go>The value of PI is
approximately 3.14159265359.</SPAN><BR><SPAN class=gp>>>> </SPAN><SPAN
class=k>print</SPAN> <SPAN class=s>'The value of PI is approximately
{!r}.'</SPAN><SPAN class=o>.</SPAN><SPAN class=n>format</SPAN><SPAN
class=p>(</SPAN><SPAN class=n>math</SPAN><SPAN class=o>.</SPAN><SPAN
class=n>pi</SPAN><SPAN class=p>)</SPAN><BR><SPAN class=go>The value of PI is
approximately 3.141592653589793.</SPAN><BR></P>
<DIV class=highlight-python>
<DIV class=highlight><PRE>I think the python code in both the {} should be modified as follows :</PRE><PRE><P><SPAN class=gp>>>> </SPAN><SPAN class=kn>import</SPAN> <SPAN class=nn>math</SPAN>
<SPAN class=gp>>>> </SPAN><SPAN class=k>print</SPAN> <SPAN class=s>'The value of PI is approximately <FONT color=#800000>{0!s}.</FONT>'</SPAN><SPAN class=o>.</SPAN><SPAN class=n>format</SPAN><SPAN class=p>(</SPAN><SPAN class=n>math</SPAN><SPAN class=o>.</SPAN><SPAN class=n>pi</SPAN><SPAN class=p>)</SPAN>
<SPAN class=go>The value of PI is approximately 3.14159265359.</SPAN>
<SPAN class=gp>>>> </SPAN><SPAN class=k>print</SPAN> <SPAN class=s>'The value of PI is approximately <FONT color=#800000>{0!r}.</FONT>'</SPAN><SPAN class=o>.</SPAN><SPAN class=n>format</SPAN><SPAN class=p>(</SPAN><SPAN class=n>math</SPAN><SPAN class=o>.</SPAN><SPAN class=n>pi</SPAN><SPAN class=p>)</SPAN>
<SPAN class=go>The value of PI is approximately 3.141592653589793.</SPAN></P><P><SPAN class=go></SPAN> </P><P><SPAN class=go><FONT size=2 face=Arial>Trust this both helps and is correct.</FONT></SPAN></P><P><SPAN class=go><FONT size=2 face=Arial></FONT></SPAN> </P><P><SPAN class=go><FONT size=2 face=Arial>I appreciate the efforts taken to offer the tutorial and often think how difficult it must be to keep the tutorial in step with the current version of Python.</FONT></SPAN></P><P><SPAN class=go><FONT size=2 face=Arial></FONT></SPAN> </P><P><SPAN class=go><FONT size=2 face=Arial>Best regards. Chris Coen</FONT></SPAN>
</P><P> </P><P><FONT size=2 face=Arial></FONT> </P><P><FONT size=2 face=Arial></FONT> </P><P><FONT size=2 face=Arial></FONT> </P><P><FONT size=2 face=Arial></FONT> </P><P><FONT size=2 face=Arial></FONT> </P></PRE></DIV></DIV></DIV></BODY></HTML>