fl writes: > 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?
Have you executed the following in that shell? from __future__ import print_function That replaces the Python 2 print command with the Python 3 print function and then you would get that error message. Apologies if you've done that because I used it in one of my examples about reversed(). I didn't mean to confuse - I've just never quite learnt the Python 2 print syntax myself. There is no "from __past__ import print_command", is there? To recover the original functionality in that shell :) -- https://mail.python.org/mailman/listinfo/python-list