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

Moin shamsi
Moin shamsi
7,579 Points

Try again! on task 1 of finding players by regular expression

for the question "Create a variable named players that is an re.search() or re.match() to capture three groups: last_name, first_name, and score. It should include re.MULTILINE." I wrote the following code. but I just get the answer of "Try again!" I don't know what is my code problem! here it is my code:

players = re.search(r''' (?P<last_name> [\w ]),\s (?P<first_name> [\w ]):\s (?P<score> [\d]*) ''', pattern, re.M)

Steven Parker
Steven Parker
231,008 Points

1 Answer

Steven Parker
Steven Parker
231,008 Points

Just guessing here...

Without a link to the challenge I'm just guessing, but perhaps the spaces between the field names and character classes are causing a problem, and perhaps the spaces following the "\s" codes also.

Moin shamsi
Moin shamsi
7,579 Points

I solved the problem. thanks for your help!