473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to create and save python program files?

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!
Jun 12 '07 #1
2 2434
bartonc
6,596 Expert 4TB
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!
I'm not a *nix guy, but I understand that any text file with the first line to the effect of
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/env python
should do it.
Jun 12 '07 #2
Smygis
126 100+
like this:

Expand|Select|Wrap|Line Numbers
  1. smygis@Bob:~$ nano myscript.py
  2. smygis@Bob:~$ cat myscript.py 
  3. #!/usr/bin/env python
  4. # coding: UTF-8
  5.  
  6. print "Hej världen. (Hello world in swedish)"
  7. smygis@Bob:~$ 
  8. smygis@Bob:~$ chmod +x myscript.py 
  9. smygis@Bob:~$ ./myscript.py 
  10. Hej världen. (Hello world in swedish)
  11. smygis@Bob:~$ 
  12. smygis@Bob:~$ nano myscript.py 
  13. smygis@Bob:~$ cat myscript.py 
  14. #!/usr/bin/env python
  15. # coding: UTF-8
  16.  
  17. print "Hej världen. (Hello world in swedish)"
  18. print "Added one line."
  19. smygis@Bob:~$ 
  20. smygis@Bob:~$ ./myscript.py 
  21. Hej världen. (Hello world in swedish)
  22. Added one line.
  23. smygis@Bob:~$ 
  24.  
For those who dont know, nano is a CLI texteditor.
Jun 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
3
by: GMane Python | last post by:
Hello All. I have a program that downloads 'gigabytes' of Axis NetCam photos per day. Right now, I set up the process to put the images into a queue, and every 30 or so seconds, 'pop' them from...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
9
by: fishbaugher | last post by:
I have encountered some interesting crashes lately (Access97). Here is the symptom (after several days of different kinds of rebuilds including import and LoadFromText, all resulting in databases...
37
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
8
by: why? | last post by:
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...
2
by: sebastien.abeille | last post by:
Hello, I would like to create a minimalist file browser using pyGTK. Having read lot of tutorials, it seems to me that that in my case, the best solution is to have a gtk.TreeStore containing...
0
by: Edwin.Madari | last post by:
since choice of dbm used by shelve http://docs.python.org/lib/node327.html depends on os, and whats available on it, shevle files saved on one os, most likely do not work on another os, sometimes on...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.