[Tutor] Shebang (#!) in the first line of a python script

Katt the_only_katala at verizon.net
Tue Oct 13 09:19:49 CEST 2009


> From: "Mark K. Zanfardino" <mzanfardino at gmail.com>
> To: Katt <the_only_katala at verizon.net>
> Cc: tutor at python.org
> Subject: Re: [Tutor] First line of a python program

> In computing, a shebang (also called a hashbang, hashpling, pound bang,
> or crunchbang) refers to the characters "#!" when they are the first two
> characters in a text file. In a Unix-like operating system, the program
>
> #! /usr/bin/python
>
> If you want to execute this script, you need to run the Python
> interpreter and tell it to load the script file and run it
> for you:
>
>  $ /usr/bin/python myscript
>
> You could just set your script to be executable (by setting the
> right permission bits) and then you can run it as a command
> without naming python yourself:
>
>  $ myscript
>

Okay.  So if I were to place the following in my Windows XP py v.2.6.2 :

$ (name of python script)

Then as long as python was in my path I would be able to type the name of 
the script like a Dos batch file (ex: lowertoupper.py or lowertoupper) 
instead of having to type python lowertoupper.py?  And it will run as 
normal?

Thanks also to Steve W.

Thanks in advance,

Katt 



More information about the Tutor mailing list