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!
How to create and save python program files?
Collapse
X
-
I'm not a *nix guy, but I understand that any text file with the first line to the effect ofOriginally posted by koolest1Im 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!should do it.Code:#!/usr/bin/env python
-
like this:
[code=python]
smygis@Bob:~$ nano myscript.py
smygis@Bob:~$ cat myscript.py
#!/usr/bin/env python
# coding: UTF-8
print "Hej världen. (Hello world in swedish)"
smygis@Bob:~$
smygis@Bob:~$ chmod +x myscript.py
smygis@Bob:~$ ./myscript.py
Hej världen. (Hello world in swedish)
smygis@Bob:~$
smygis@Bob:~$ nano myscript.py
smygis@Bob:~$ cat myscript.py
#!/usr/bin/env python
# coding: UTF-8
print "Hej världen. (Hello world in swedish)"
print "Added one line."
smygis@Bob:~$
smygis@Bob:~$ ./myscript.py
Hej världen. (Hello world in swedish)
Added one line.
smygis@Bob:~$
[/code]
For those who dont know, nano is a CLI texteditor.Comment
Comment