[Tutor] interactive mode questions
rick
rdole1 at cogeco.ca
Fri Dec 25 17:49:36 CET 2009
I'm working my way through Mr Lutz's "Learning Python", and I come to
this snippet (page 271):
while True:
reply = input('Enter text:')
if reply == 'stop': break
print(reply.upper())
which works "as advertised" in an interactive session, but not in a
script. Yes, I tried tossing the script to both versions of
interpreter, it doesn't work with either 2.6 or 3.1.
text given as input results in NameError: name 'text' is not defined.
numerical input results in AttributeError: 'int' object has no attribute
'upper'
either way, enclosing the input in quotes works.
More information about the Tutor
mailing list