Newbie questions on import & cmd line run

Mark Lawrence breamoreboy at yahoo.co.uk
Thu May 17 09:53:02 EDT 2012


On 17/05/2012 05:29, Chris Rebert wrote:
> On Wed, May 16, 2012 at 6:45 PM, gwhite<gwhite at ti.com>  wrote:
>> #!<what is supposed to go here?>
>
> That's a shebang line. See http://en.wikipedia.org/wiki/Shebang_(Unix)
> It's doesn't matter at all since you're on Windows. On Unix-like
> systems, one typically writes:
>      #!/usr/bin/env python
>
>> # Filename: newbie00.py
>>
>> if __name__ == '__main__':
>
> Cheers,
> Chris

For the record quoting from http://www.python.org/dev/peps/pep-0397/

"As Python 3.x scripts are often syntactically incompatible with Python 
2.x scripts, a different strategy must be used to allow files with a 
'.py' extension to use a different executable based on the Python 
version the script targets. This will be done by borrowing the existing 
practices of another operating system - scripts will be able to nominate 
the version of Python they need by way of a "shebang" line, as described 
below."

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list