diff options
| author | E7-87-83 <fungcheokyin@gmail.com> | 2021-05-02 21:12:39 +0800 |
|---|---|---|
| committer | E7-87-83 <fungcheokyin@gmail.com> | 2021-05-02 21:12:39 +0800 |
| commit | 36318fa49b15eee8e9f9a66f03022009fdf12b99 (patch) | |
| tree | 717885f56b22e69c0571a89eff554451685ca88a /challenge-110/abigail/python/ch-1.py | |
| parent | c6f8f5b8fc12980a57f4db78f1da65523ccce32f (diff) | |
| parent | 14b2dabae68197e73c48121eb964de12e9ba9afc (diff) | |
| download | perlweeklychallenge-club-36318fa49b15eee8e9f9a66f03022009fdf12b99.tar.gz perlweeklychallenge-club-36318fa49b15eee8e9f9a66f03022009fdf12b99.tar.bz2 perlweeklychallenge-club-36318fa49b15eee8e9f9a66f03022009fdf12b99.zip | |
Merge remote-tracking branch 'upstream/master' into newt
Diffstat (limited to 'challenge-110/abigail/python/ch-1.py')
| -rw-r--r-- | challenge-110/abigail/python/ch-1.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-110/abigail/python/ch-1.py b/challenge-110/abigail/python/ch-1.py new file mode 100644 index 0000000000..63e3c8e69e --- /dev/null +++ b/challenge-110/abigail/python/ch-1.py @@ -0,0 +1,19 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-1.py < input-file +# + +import fileinput +import re + +for line in fileinput . input (): + plain = re . sub (r'\s+', "", line) # Strip whitespace + plain = re . sub (r'^\+', "00", plain) # Replace leading + + plain = re . sub (r'^\([0-9][0-9]\)', "0000", plain) # Replace leading (NN) + if re . search (r'^[0-9]{14}$', plain): # Chech for 14 digits + print (line, end = '') |
