code to parse a file
thomas at bibsyst.no
Thu Feb 10 10:37:32 EST 2000
> Pedro Silva wrote:
> I had write some code in a Python Method, a Zope Product, that will
> open a file and will read line-by-line and check if some string is in
> that line, if yes, it will return the line to a variable.
> The code I write is:
> for lines in f.readline():
> if string.find('From:'):
> if string.find('Subject:'):
> if string.find('Date:'):
> if string.find('Xref:'):
> for text in f.read():
> return from,sub,date,cont
> Is this code correct to do what I pretend?
> If not, can anyone help me to solve this?
> Please send your answers to: psilva at ruido-visual.pt
If I`m not mistaken, your posting is written in, or at least sent as,
HTML. Not smart when posting to newsgroups. I don`t actually care, but
you`ll get alot of flak from text-based-newsreading-hardcore kinda
people. And most people, probably the same group, will not bother to
send answers directly to your email adress, but send it all to the
newsgroup. I`ve tried this and that`s how I know. ;->
Did I answer your python-question? Well ....
More information about the Python-list