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 trial

Python Regular Expressions in Python Introduction to Regular Expressions Email

keith rezendes
keith rezendes
4,459 Points

find_emails not working

This challenge is not working.

I've noticed the direction ask us to create a function find_emails but within the sample snippet it has find_email.

I am sure this code works as I tested in the editor but here the error message does not make sense. You can clearly see my find_emails function. I even change it to find_email just in case it might be an issue. Still same error.

sets_email.py
import re

def find_emails(string):
    return re.findall(r'[-\w\d+.]+@[-\w\d.]+', string)



# 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']

1 Answer

Ryan McGuire
Ryan McGuire
3,758 Points

Think you just need to wrap the section after return in parens return (re.findall(r'[-\w\d+.]+@[-\w\d.]+', string))