[docs] Tutorial problem

Sandro Tosi sandro.tosi at gmail.com
Wed Feb 23 00:43:01 CET 2011


Hi Joe,
thanks for your email,

On Tue, Feb 1, 2011 at 16:28, Joe McDonald <jam at massa.com> wrote:

>>>> print 'This {food} is {adjective}.'.format(food='spam',
>>>> adjective='absolutely horrible')
>
>
>
> Traceback (most recent call last):
>
>   File "<pyshell#20>", line 1, in -toplevel-
>
>     print 'This {food} is {adjective}.'.format(food='spam',
> adjective='absolutely horrible')
>
> AttributeError: 'str' object has no attribute 'format'

On what interpreters are you running that example? I just built a 2.7
from the VCS branch and I can run it with no problem:

$ ./python
Python 2.7.1+ (release27-maint, Feb 23 2011, 00:40:53)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'This {food} is {adjective}.'.format(food='spam', adjective='absolutely horrible')
This spam is absolutely horrible.
[38484 refs]
>>>

Regards,

-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


More information about the docs mailing list