[Tutor] error message

Ron Nixon nixonron at yahoo.com
Mon Feb 14 02:01:33 CET 2005


I'm dping something very simple in RE.

Lets say I'm trying to match an American Phone number

I write the code this way and try to match it:
import re
string = 'My phone is 410-995-1155'
pattern = r'\d{3}-\d{3}-\d{4}'
re.match(pattern,string).group()

but I get this error message
Traceback (most recent call last):
  File "C:/Python24/findphone", line 4, in -toplevel-
    re.match(pattern,string).group()
AttributeError: 'NoneType' object has no attribute 'group'


		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


More information about the Tutor mailing list