Source

Feast-Dates Data / romcal2csv.py

Full commit
import csv
from datetime import datetime

def handle(filename):
  reader = csv.reader(open(filename, "r"), delimiter=':', quoting=csv.QUOTE_NONE)
  writer = csv.writer(open(filename.replace(".txt", ".csv"), "w"))
  # [1900, 12, 14, 'Fri Dec 14, 1900', 'Memorial ', 'White  ', 'John of the Cross, P & D']
  for date, type, color, name in reader:
    dt = datetime.strptime(date, "%a %b %d, %Y")
    type = type.strip()
    color = color.strip()
    writer.writerow([dt.year, dt.month, dt.day, date, type, color, name])

def main(args):
  for arg in args:
    handle(arg)

if __name__ == "__main__":
  import sys
  # filename = "1900-2200.txt"
  main(sys.argv[1:])