scriptmode.txt I will explain how to do it by using an example. Create a file named hello.py containing print "\nHello world!" print "Welcome to the world of Python!" print "We will have some fun!!!" using an editor of your choice: Notepad, emacs, etc. So, this script file contains only two lines of print command. I have included my version of hello.py in the list of files under Lecture 1. To run the script that you just created, do: 1. Open a command (terminal) window. 2. Go to the folder where hello.py is located. The 'cd' command will be useful as you move around the folders in your file system. Also 'ls' command for Mac and 'dir' for Windows. 3. Try the python command with the script file (hello.py in this case) as follows. Here prompt> is whatever prompt that you get on your system. The result of executing the program (hello.py in this case) will be displayed. prompt> python hello.py Hello world! Welcome to the world of Python! We will have some fun!!! prompt> The program files that I included in this tutorial are all valid Python script files. So, download and try them on your system as you go through the tutorial. That is one of the reasons I kept them as plain text files rather than creating them as HTML files. Try the following and see what happens: prompt> ipython hello.py You can run a script from ipython in addition to the usual interaction with the interpreter. Try the following to run hello.py. I am showing you a log of what I did: ------------------ the log starts here -------------------------------- alee$ ipython Enthought Python Distribution -- www.enthought.com Python 2.7.2 |EPD 7.1-2 (64-bit)| (default, Jul 27 2011, 14:50:45) Type "copyright", "credits" or "license" for more information. IPython 0.11 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: pwd # To see where I am in the file system Out[1]: u'/Users/alee' In [2]: cd aa/python_2011 # To move to the folder /Users/alee/aa/python_2011 In [3]: pwd Out[3]: u'/Users/alee/aa/python_2011' In [4]: execfile("hello.py") # To run the script Hello world! Welcome to the world of Python! We will have some fun!!! In [5]: exit() alee$ ----------------------- end of the log -------------------------- Some of these interactions are also available in a regular interactive python session, e.g., the execfile command. pwd and cd (the usual unix commands) are not available though in regular python although they are available in ipython,