#!/bin/python # Expire articles from a hep feed, or more generally from a POP3 mailbox. # (An ancestor of rawdog, I suppose...) # Adam Sampson username = "azz" password = "password" count = 200 from poplib import POP3 pop = POP3("localhost", 5336) pop.user(username) pop.pass_(password) list = pop.list()[1] n = len(list) - count if n < 0: n = 0 for x in list[:n]: num = int(x.split(" ")[0]) pop.dele(num) pop.quit()