Parse specific text in email body to CSV file

dpw.asdf at gmail.com dpw.asdf at gmail.com
Sat Mar 8 17:20:36 EST 2008


I have been searching all over for a solution to this. I am new to
Python, so I'm a little lost. Any pointers would be a great help. I
have a couple hundred emails that contain data I would like to
incorporate into a database or CSV file. I want to search the email
for specific text.

The emails basically look like this:



random text _important text:_15648 random text random text random text
random text
random text random text random text _important text:_15493 random text
random text
random text random text _important text:_11674 random text random text
random text
===============Date: Wednesday March 5, 2008================
name1: 15                name5: 14

name2: 18                name6: 105

name3: 64                name7: 2

name4: 24                name8: 13



I want information like "name1: 15" to be placed into the CSV with the
name "name1" and the value "15". The same goes for the date and
"_important text:_15493".

I would like to use this CSV or database to plot a graph with the
data.

Thanks!



More information about the Python-list mailing list