Why it does NOT work on Linux ?

Jason Orendorff jason at jorendorff.com
Mon Feb 4 20:00:22 EST 2002


Steve Holden wrote:
> Markus Schönhaber wrote:
> > 1.) Here
> > > IDs=re.compile('.*<a href="lead.asp\?ItemID=(\d{5,10}).*')
> > > Results=re.findall(IDs,Text)
> >
> > you call re.findall with a regular expression object as a first
> > parameter which should be a string. What you want to do is
> >
> > Results = IDs.findall(Text)
> >
> > i. e. call the appropriate method on the re object you created.
> >
> While your suggestion is correct, it is incorrect to say that Ladislav's
> method is wrong.

Ladislav's use of findall works, but this feature of re.findall()
is not documented and should be avoided, as undocumented features
have been known to disappear.

## Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list