Op 25-12-09 17:49, rick schreef:
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:')
Try this:
reply = raw_input('Enter text: ')
Cheers,
Timo
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.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor