i got the syntax error reaction while try coding like bellow in python interactive mode.
>>> while True:
... reply = raw_input('enter text:')
... if reply == 'stop':
... break
... print reply
... print 'bye'
File "<stdin>", line 6
print reply
^
SyntaxError: invalid syntax
>>>
but it executed normally if save as script.
~ $cat test.py
#!/usr/bin/env python
# encoding=utf8
while True:
reply = raw_input('enter text:')
if reply == 'stop':
break
print reply
print 'bye'
~ $python test.py
enter text:19
19
enter text:456789
456789
enter text:$%^&*(
$%^&*(
enter text:TGHJKLO:P
TGHJKLO:P
enter text:#$%^&*()_
#$%^&*()_
enter text:stop
bye
is it a bug? or any other things i should know about python interactive mode?
~ $python -V
Python 2.6.6