Re: A simple print cannot run in Python Shell

2015-06-01 Thread Tim Golden
On 01/06/2015 09:30, Steven D'Aprano wrote: > How do you run it in Windows 7? The hashbang line > > #!/usr/bin/python > > is for Linux and Unix, and won't work on Windows. So you must be doing > something to execute the file. What is that? Actually, it will for anywhere with a recent Python

Re: A simple print cannot run in Python Shell

2015-06-01 Thread Steven D'Aprano
On Monday 01 June 2015 17:50, fl wrote: > Hi, > > When I try the following (They are saved in a main.py file) > > #!/usr/bin/python > print r'C:\\nowhere' Aside: Don't use raw strings for file names. They aren't intended for file names, and while they will *usually* work, some day you will try

Re: A simple print cannot run in Python Shell

2015-06-01 Thread Jussi Piitulainen
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 foll

A simple print cannot run in Python Shell

2015-06-01 Thread fl
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'