Programs and Files

Programs are generally placed in .py files like this

     # helloworld.py
     print "Hello World"
     

To run a file, give the filename as an argument to the interpreter

     unix % python helloworld.py
     Hello World
     unix % 

Or you can use the Unix #! trick

     #!/usr/local/bin/python
     print "Hello World" 

Or you can just double-click on the program (Windows)

<<< O'Reilly OSCON 2000, Introduction to Python, Slide 8
July 17, 2000, beazley@cs.uchicago.edu
>>>