How to save python codes in files?

why? jimbomaan at
Wed Jun 13 10:06:12 CEST 2007

Evan Klitzke wrote:
> On 6/12/07, why? <jimbomaan at> wrote:
> > Im working with Python 2.2 on my red hat linux system. Is there any
> > way to write python codes in separate files and save them so that i
> > can view/edit them in the future? Actually I've just started with
> > python and would be grateful for a response. Thanx!
> Of course -- just put the code into a text file (using your favorite
> text editor) and then run the script using the python command, e.g. by
> executing on a command line:
>   python
> Since you're on a Linux system you can also use this as the first line
> of your file and then chmod +x the file to make it into an executable
> script:
> #!/usr/bin/env python
> --
Im still unable to follow... :(
See, if i have to save the following code in a file, how should i
>>> def sum(x,y): return x+y

More information about the Python-list mailing list