#!/bin/python from __future__ import with_statement import os import sys from glob import glob from datetime import datetime with open('header.html') as f: header = f.read().decode('utf-8') with open('footer.html') as f: footer = f.read().decode('utf-8') mails = sorted(glob('*.raw')) latest = None def format_title(name): return datetime.strptime(name, '%Y-%m-%d').strftime('%B') + ' Newsletter' navigation = u'
' for mail in reversed(mails): name = mail[:-4] print name title = format_title(name) nav = navigation.replace(u'