Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Processing one text file into multiple

Status
Not open for further replies.

jabhawk

Programmer
Apr 23, 2002
71
US
I am new to Python and I need to do the following:
I receive resume emails (30+ daily) from a web form as formatted text and I save each daily group of messages from Outlook to a text file.

I need to run down the long text file and pull out specific lines to a temp text file, run a function against the file and write out formatted resume test files for our filing system.

Each of the lines follow this format:
Address: MiniFieldStorage('Address', '123 West St')
Answer1: MiniFieldStorage('Answer1', 'Yes')
Any line not following this format must be ignored and each finished group must be written out to a unique filename "ex. res####.txt".

I have the formatting function that will take as input the temp file and write out to the final file. I just need a simple script to read the big file and cut it up for me.

All help is always appreciated
jab_hawk@yahoo.com
Python 2.3
Windows 2000

Jonthan A Black
 
Why not just loop through the big file one line at a time and use a regular expression to decide whether to write to temp file or not?

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top