Regular Expression help

RunLevelZero Aiwass333 at gmail.com
Thu Apr 27 14:20:48 EDT 2006


I have some data and I need to put it in a list in a particular way.  I
have that figured out but there is " stuff " in the data that I don't
want.

Example:

10:00am - 11:00am:</b> <a
href="/tvpdb?d=tvp&id=167540528&cf=0&lineup=us_KS57836d&channels=us_KCTV&chspid=166030466&chname=CBS&progutn=1146150000&.intl=us">The
Price Is Right</a><em>

All I want is " Price Is Right "

Here is the re.

findshows =
re.compile(r'(\d\d:\d\d\D\D\s-\s\d\d:\d\d\D\D:*.*</a><em>)')

I have used a for loop to remove the extra data but then it ruins the
list that I am building.  Basically I want the list to be something
like this.

[[Government Access], [Price Is Right, Guiding Light, Another show]]

the for loop just comma deliminates all of them so I lose the list in a
list that I need.  I hope I have explained this well enough.  Any help
or ideas would be appreciated.

TIA




More information about the Python-list mailing list