python3 mystery
Jude DaShiell <[email protected]>
| Newsgroups | gmane.linux.redhat.blinux.general |
|---|---|
| Message-ID | <[email protected]> |
Script started on Tue 15 Sep 2015 06:34:47 AM EDT jude@iceberg:~$ cat gpe.py import re examplestring='''Jessica is 15 years old and Daniel is 27 years old Edward is 97 years old and his grandfather Oscar is 102.''' ages=re.findall(r'\d[1,3]',examplestring) names=re.findall(r'[A,Z][a,z]*',examplestring) print(names) print(ages) jude@iceberg:~$ python3 gpe.py [] [] jude@iceberg:~$ exit exit Script done on Tue 15 Sep 2015 06:35:38 AM EDT Why don't the names and ages lists get populated from exampleString then return names and ages in the examplestring vriable? This is a worked regular expressions exmple on http://www.pythonprogramming.net/ and as near as I can tell I keyed it in correctly. --