[Tutor] was no subject, getting started
Charlie Clark
charlie@begeistert.org
Sat, 02 Mar 2002 16:56:09 +0100
On 2002-03-02 at 13:10:03, tutor-request@python.org wrote:
> I think it has something to do with writing it into a
> text file and saving it but I cant figure out how to
Python programs are text files and should be edited with a text editor.
Sheila has said how you can do this in IDLE which is a text editor with an
interactive command line.
You run the scripts you've written by giving them to the Python interpreter
to run. On POSIX-compliant systems this is quite easy by setting up the
appropriate environment variable, putting #!/bin/env Python as the first
line and making the file executable. Otherwise just enter Python in the
command line or DOS session with the name of your script as the second word.
If you're in windows you have my sympathy.
c:\ python myscript.py
You will probably need to add the appropriate paths and actually have
something like this
c:\ c:\python21\python c:\my documents\python\myscript.py
Windows is not really very nice for developing partly because of these
problems.
> money = 1000
> none = 100
> print money + none
Nobody else mentioned this but "None" is a reserved word in Python: it
stands for an object with no content so it is not the same as "0". Python
is case sensitive so your variable "none" is different to "None". You can
overwrite such words in Python without raising an error but this is quite
likely to cause confusion and thus problems.
The people who write Python are careful not to create too many reserved
words so that the chances of this happening are rare. Ones to watch out for
are "list" and "type"
Charlie