diff options
Diffstat (limited to 'challenge-110/abigail/python/ch-2.py')
| -rw-r--r-- | challenge-110/abigail/python/ch-2.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-110/abigail/python/ch-2.py b/challenge-110/abigail/python/ch-2.py new file mode 100644 index 0000000000..c5ba11fae6 --- /dev/null +++ b/challenge-110/abigail/python/ch-2.py @@ -0,0 +1,30 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-2.py < input-file +# + +import fileinput + +outputs = [] + +# +# Read input, split on commas, build output strings. +# +for line in fileinput . input (): + fields = line . rstrip () . split (",") + if (len (outputs)): + for i in range (len (fields)): + outputs [i] = outputs [i] + "," + fields [i] + else: + outputs . extend (fields) + +# +# Print output lines +# +for line in outputs: + print (line) |
