diff options
Diffstat (limited to 'challenge-110/stuart-little/python/ch-1.py')
| -rwxr-xr-x | challenge-110/stuart-little/python/ch-1.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-110/stuart-little/python/ch-1.py b/challenge-110/stuart-little/python/ch-1.py new file mode 100755 index 0000000000..1287c19b6f --- /dev/null +++ b/challenge-110/stuart-little/python/ch-1.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# run <script> <path-to-file or nothing> +# defaults to challenge sample if no file is entered + +import re +import sys + +if (len(sys.argv)>1): + with open(sys.argv[1]) as f: + data=f.read() +else: + data=""" +0044 1148820341 + +44 1148820341 + 44-11-4882-0341 +(44) 1148820341 + 00 1148820341 +""" +rgx=re.compile(r'((?:\+\d{2}|\(\d{2}\)|\d{4})\s+\d{10})') +nrs=re.findall(rgx,data) +for nr in nrs: + print(nr) |
