Mercurial > hg > freeDiameter
view contrib/tools/org_to_csv @ 1554:566bb46cc73f
Updated copyright information
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 06 Oct 2020 21:34:53 +0800 |
parents | a86eb3375b95 |
children |
line wrap: on
line source
#!/usr/bin/env python """ Convert |-separated 11-column .org files to CSV, with first and last empty columns ignored. """ import csv import fileinput import re import sys csvout = csv.writer(sys.stdout) for line in fileinput.input(): row = re.split(r'\s*\|\s*', line) row.extend([''] * (10 - len(row))) csvout.writerow(row[1:10]) # vim: set et sw=4 sts=4 :