Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From bill@whitehouse.gov
- To buffy@airhead.net
- Date Saturday, October 4, 1997
- Subject Get together
- Hey, honeypie. Ole Big Daddy sure is missin you. I’ll be a
- lookin for you to come around again this weekend.
- Love,
- Bill
- From veep@whitehouse.gov
- To buddha@whitehouse.gov
- Date Monday, October 6, 1997
- Subject BM
- Dear Buddha, I just had a BM. Please advise.
- From reno@justice.gov
- To bill@whitehouse.gov
- Date Wednesday, October 8, 1997
- Subject Roby Ridge
- Mr. President:
- The situation with the lady in Roby is quickly deteriorating.
- I advise we use an Apache loaded with napalm to flush the crazy
- woman out. If it kills her, it serves her right for that Vaseline
- trick. Dead or alive, at least it will be over. If I don’t hear
- from you within the next hour, I’ll send for the chopper.
- Janet
- From buddha@whitehouse.gov
- To veep@whitehouse.gov
- Date Saturday, November 8, 1997
- Subject Re: BM
- Thank you for advising me of your BM. You may not have
- another BM until Monday, November 3, 1997.
- import datetime
- def search_match(t, f):
- return t.startswith('From veep@whitehouse.gov') and f.startswith('To buddha@whitehouse.gov')
- def get_date(date):
- prefix = date.strftime('%A, %B ')
- day = date.strftime('%d').lstrip('0')
- postfix = date.strftime(', %Y')
- return '{0}{1}{2}'.format(prefix, day, postfix)
- with open('whmail.log') as f:
- for line in f:
- if search_match(line, f.readline()):
- date, subject = datetime.datetime.strptime(f.readline().strip()[5:], "%A, %B %d, %Y"), f.readline()
- subject = 'Re:' + subject[7:]
- limit = date + datetime.timedelta(days=28)
- sent = limit + datetime.timedelta(days=5)
- print('From veep@whitehouse.govnTo buddha@whitehouse.govnDate {0}nSubject {1}nThank you for advising me of your BM. You may not havenanother BM until {2}'.format(get_date(sent), subject, get_date(limit)))
Add Comment
Please, Sign In to add comment