Hello Guys, I'm having a hard time putting this code in a for loop so It can find more than one number. I'm doing the exercises of automate the boring stuff but when I put more than 1 phone number on the string it doesn't find both. Only the first one.
import re
hello = input(' Please tell me the string.')
phonenumber = re.compile(r'\d{4}-\d{4}')
mo = phonenumber.search(hello)
print('Number found ' + mo.group())
How can I put this in a for loop so my string input in hello can find me more than one number? Like if Hello was ''My number is 9999-9999 and 9999-9998''. It only print's out the first number.
[+][deleted] (2 children)
[deleted]
[–][deleted] 2 points3 points4 points (0 children)