]> code.delx.au - monosys/blob - csv2txt
lib-ext-backup: move snapshot cleanup code into the correct function
[monosys] / csv2txt
1 #!/usr/bin/env python3
2
3 import csv
4 import sys
5
6 rows = list(csv.reader(sys.stdin))
7 column_widths = list(max((len(str(cell))) for cell in column) for column in zip(*rows))
8 for row in rows:
9 print("".join(str(cell).ljust(width+1) for cell, width in zip(row, column_widths)))