[Tutor] newbie text parsing question
Ron Nixon
nixonron@yahoo.com
Wed, 28 Aug 2002 08:57:22 -0700 (PDT)
--0-1024771816-1030550242=:8637
Content-Type: text/plain; charset=us-ascii
Ive got a file that looks like this:
Case Number: 076-2000 Recall Notification Report: RNR076-2000
Date Opened: 12/20/2000 Date Closed: 04/20/2001
Recall Class: 1 Press Release (Y/N): Y
Domestic Est. Number: 02040 M Name: Harper's Country Ham
Imported Product (Y/N): Y Foreign Estab. Number: N/A
City: Clinton State: KY Country: USA
Product: Country Ham
Problem: BACTERIA Description: LISTERIA
Total Pounds Recalled: 10,400 Pounds Recovered: 7,561
I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this:
076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc
that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance
Ron
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
--0-1024771816-1030550242=:8637
Content-Type: text/html; charset=us-ascii
<P>Ive got a file that looks like this:</P>
<P> Case Number: 076-2000 Recall Notification Report: RNR076-2000<BR> Date Opened: 12/20/2000 Date Closed: 04/20/2001<BR> Recall Class: 1 Press Release (Y/N): Y<BR> Domestic Est. Number: 02040 M Name: Harper's Country Ham<BR> Imported Product (Y/N): Y Foreign Estab. Number: N/A<BR> City: Clinton State: KY Country: USA<BR> Product: Country Ham<BR> Problem: BACTERIA Description: LISTERIA<BR> Total Pounds Recalled: 10,400 Pounds Recovered: 7,561</P>
<P> </P>
<P>I'd like to be able to read all of the file in a extract the data following the Title and ":" to produce some like this:</P>
<P>076-2000, RNR076-2000,04/20/2001,04/20/2001,1,Y,02040 M, Harper's Country Ham, etc</P>
<P>that I can then import into a spreadsheet or database. I found nothing at the Python.org site nor in the Text Processing using Python book. Any ideas? thanks in advance</P>
<P> </P>
<P>Ron</P><p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="http://rd.yahoo.com/finance/mailsig/new/*http://finance.yahoo.com">Yahoo! Finance</a> - Get real-time stock quotes
--0-1024771816-1030550242=:8637--