A simple print cannot run in Python Shell

fl rxjwg98 at gmail.com
Mon Jun 1 03:50:30 EDT 2015


Hi,

When I try the following (They are saved in a main.py file)

#!/usr/bin/python
print r'C:\\nowhere'


It works as the tutorial, i.e. it echoes in a Windows 7
command console:


C:\\nowhere








When I run the following command in a Python 2.7.9 Shell on Windows 7,


print r'C:\\nowhere'



It has error:

>>> print r'C:\\nowhere'
SyntaxError: invalid syntax




What is the problem? Why does it behave different at .py file
and Python Shell?


Thanks, 



More information about the Python-list mailing list