[Tutor] Regular Expression Misunderstanding
Steve Nelson
sanelson at gmail.com
Fri Jul 14 15:02:42 CEST 2006
On 7/14/06, John Fouhy <john at fouhy.net> wrote:
> >>> m = re.match(...)
> >>> dir(m)
>
> It will tell you what attributes the match object has.
Useful - thank you.
I am now confuse on this:
I have a file full of lines beginning with the letter "b". I want a
RE that will return the whole line if it begins with b.
I find if I do eg:
>>> m = re.search("^b", "b spam spam spam")
>>> m.group()
'b'
How do I get it to return the whole line if it begins with a b?
S.
More information about the Tutor
mailing list