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 trialLucia Boll
4,015 PointsWhy do I get an error message? If I enter the same code in my IDE, I get the desired result.
Error Message: Bummer: Didn't get the right output. Got None, expected ['kenneth@teamtreehouse.com', 'andrew+gotcha@teamtreehouse.com', 'exa.mple@example.co.uk'].
import re
def find_emails(data):
return print(re.findall(r'[-\w\d+.]+@[-\w\d.]+', data)) #E_mail
# Example:
# >>> find_email("kenneth.love@teamtreehouse.com, @support, ryan@teamtreehouse.com, test+case@example.co.uk")
# ['kenneth@teamtreehouse.com', 'ryan@teamtreehouse.com', 'test@example.co.uk']
2 Answers
Logan R
22,989 PointsHi Lucia,
The issue is that you have wrapped your regex function inside of a print
function. The print
function returns None. If you remove the print function, your code will work.
def find_emails(data):
return re.findall(r'[-\w\d+.]+@[-\w\d.]+', data) #E_mail
Lucia Boll
4,015 Pointsah yes - thanks