Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialbenjamin siverly
3,430 PointsAny reason why my address_book capture is returning an empty list?
print(re.findall(r'''
([-\w ]+,\s[-\w]+)\t # name
([-\w\d.+]+@[-\w\d.]+)\t # email
(\(\d[3]\)?-?\s?d{3}-\d{4})\t # phone
([\w\s]+,\s[\w\s]+) # job / company
(@[\w\d]+) # twitter
''', data, re.X))
2 Answers
marvinriley
3,708 PointsHi. You have two main errors that I can see.
phone line: {3} instead of [3] and no ? in at the beginning.
job company line: you have no \t at the end of the line.
the below script should work for you.
print(re.findall(r''' ([-\w ]+,\s[-\w ]+)\t # last and first names. ([-\w\d.+]+@[-\w\d.]+)\t # Email ((?\d{3})?-?\s?\d{3}-\d{4})\t # Phone number ([\w\s]+,\s[\w\s]+)\t # Job company (@[\w\d]+) # TwitterHandle ''', data, re.X))
Ross Coe
5,061 Points^ need to watch out =your parens are not escaped !!
Cheo R
37,150 PointsCheo R
37,150 PointsWhat doest your data look like?