All we need is age

Report a typo

Suppose you have a numbered list of friends' names and their corresponding ages. For example:

people = '''1. John 25
            2. Mary 28
            3. Lucy 45
         '''

Here's a code for extracting only their age as a list using regexps. It produces the age at the end of each line:

results = re.findall(r'\d+$', people, flags=X)

What flag should be used instead of X? Use the short notation!

Enter a short text
___

Create a free account to access the full topic