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 Compiling and Loops

boi
boi
14,242 Points

Extra credit submission

A quick extra credit solution.

import re

from address_book import line, data


class Person(list):
  def __init__(self):
    for match in line.finditer(data):
      self.append(match.groupdict())


class Address_Book:
  def __init__(self, arg):
    for x in Person():
      for key, value in x.items():
        if value == arg:
          for key, value in x.items():
            print("{}: {}".format(key, value))


info = input("Enter person name: ").capitalize()
person = Address_Book(info)

Disclaimer This solution is not absolute nor the right one. It carries loopholes, unpolished lines, and a sh*t ton of bugs. I just needed to make it work ASAP and move on. If someone is crazy enough to fix it or use it, do it without question.