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 trialAmmar Fatihallah
7,417 PointsGot no output
While going through the video i tried to do write the same code as the instructor wrote. but as i ran the program, i got an empty tuple. i tried checking the code but couldn't see any difference. here's my code:
print(re.findall(r'''
([-\w ]+, \s[-\w ]+)\t # names
([-\w\d.+]+@[-\w\d.]\t) # emails
(\(?\d{3}\)?-?\s?\d{3}-\d{4})\t # phones
([\w\s]+,\s[\w\s]+)\t # job and company
(@[\w\d]+) # Twitter
''', data, re.X))
2 Answers
Alx Ki
Python Web Development Techdegree Graduate 14,822 PointsHI, Ammar Fatihallah ! Try this:
print(re.findall(r'''
^([-\w ]*, \s[-\w ]+)\t # names
([-\w\d.+]+@[-\w\d.]+)\t # emails
(\(?\d{3}\)?-?\s?\d{3}-\d{4})?\t # phones
([\w\s]+,\s[\w\s.]+)\t? # job and company
(@[\w\d]+)?$ # Twitter
''', data, re.X|re.M))
Daesy Stephens
4,590 Pointschange instead re.findall to re.search
Ammar Fatihallah
7,417 PointsAmmar Fatihallah
7,417 Pointscan you please tell me why code didn't work ? Was it a typo ?
Alx Ki
Python Web Development Techdegree Graduate 14,822 PointsAlx Ki
Python Web Development Techdegree Graduate 14,822 PointsAmmar Fatihallah , main problems: