[Tutor] Editing files through Python

Bryan juicebypi216 at yahoo.com
Mon Aug 30 21:38:38 CEST 2004


Hi,
 
I am a beginner in Python, and this is my first time using this list so I hope my question is acceptable.
 
Basically, my goal is to read data files that are already on my hard drive into Python, and then edit them, deleting unneccesary portions of data.
 
I have already figured out how to read the files into Python, I just cannot figure out how to edit them.  Here are the difficulties:
 
How do I delete, cut, or paste portions of the data I am reading and how do I tell the program to jump to that specific portion of data that I want to alter?
 
Here is a somewhat complicated example, similar to what I want to do - 
 
I have two rows of numbers, as shown below.  Each row has 10 numbers (hopefully they will show up as two rows of numbers in the email (1-10 and 11-20).
 
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
11, 12, 13, 14, 15, 16, 17, 18, 19, 20
 
What commands might I use to automatically go through each row, deleting the 6th through 10th numbers in each row (6-10 in the first row and 16-20 in the second row).  
 
I would like to write a program because I have hundreds of rows like this.  
 
I appreciate any help
 
Thanks
Bryan

		
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040830/1a03337f/attachment.htm


More information about the Tutor mailing list