diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2021-05-03 18:31:36 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2021-05-03 18:31:36 +0800 |
| commit | 81252bda7fb7bcc9e9e153a6b3d268ab8c1a38c8 (patch) | |
| tree | e4df369a6349802da33aa6d94b7fe745041a9955 /challenge-110/abigail/python/ch-1.py | |
| parent | 0142974e5f11adadbaa7ca8d71de9db345318519 (diff) | |
| parent | 0381a39b17ccd040302474f25d3c1cbbef703327 (diff) | |
| download | perlweeklychallenge-club-81252bda7fb7bcc9e9e153a6b3d268ab8c1a38c8.tar.gz perlweeklychallenge-club-81252bda7fb7bcc9e9e153a6b3d268ab8c1a38c8.tar.bz2 perlweeklychallenge-club-81252bda7fb7bcc9e9e153a6b3d268ab8c1a38c8.zip | |
Merge remote-tracking branch 'upstream/master'
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 = '') |
