Re: Python student seeks help regex/strings

2009-04-11 Thread John Machin
On Apr 12, 2:30 pm, Petyr David wrote: > I'm familiar with simple string substitutions in shell and perl: > > string= "I have 30 days to find it" > > echo $string | sed "s/\(.*\)\(30\)\(.*\)/\2/ > > which will (if I did it right) leave 30 > > and perl likewise. > > I'm having trouble figuring out

Re: Python student seeks help regex/strings

2009-04-11 Thread n00m
>>> s = 'I have 30 days to find it' >>> ss = filter(lambda si: si.isdigit(), s) >>> ss '30' >>> -- http://mail.python.org/mailman/listinfo/python-list

Python student seeks help regex/strings

2009-04-11 Thread Petyr David
I'm familiar with simple string substitutions in shell and perl: string= "I have 30 days to find it" echo $string | sed "s/\(.*\)\(30\)\(.*\)/\2/ which will (if I did it right) leave 30 and perl likewise. I'm having trouble figuring out how to do this in Python and it's not for lack of trying