re.sub problem
Terry Reedy
tjreedy at udel.edu
Fri Nov 3 12:27:15 EST 2000
More information about the Python-list mailing list
Fri Nov 3 12:27:15 EST 2000
- Previous message (by thread): autoconf macro to detect Python?
- Next message (by thread): re.sub problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Tim Hicks" <tim.hicks at iname.com> wrote in message news:02oM5.146$856.1663 at news11-gui.server.ntli.net... > I have a series of lines that are received from an IMAP server that I would > like to trim down. There are two examples of these below. > > 24 ('24 (BODY[HEADER.FIELDS (FROM SUBJECT)] {56}', 'From: > tele at telegraph.co.uk\015\012Subject: TPLO Sport Talk\015\012\015\012') > 41 ('41 (BODY[HEADER.FIELDS (FROM SUBJECT)] {88}', 'From: The Mutual > <mobilesatprizescratch.com at traq.it>\015\012Subject: Great WAP Phone > Offer\015\012\015\012') > > I want to remove everything up to the " 'From: " and everything after the > end of the subject of the email (should be obvious where that is). I figured > that I should use re, I would use slice and find method if needed from_subject = stuff[29:-6] # numbers approximate If inital junk now always same length, use string.find or stuff.find('From') to get initial slice position
- Previous message (by thread): autoconf macro to detect Python?
- Next message (by thread): re.sub problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list