| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| (no file at all) | |
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import sys | |
| 4 import os | |
| 5 import re | |
| 6 from datetime import datetime, timedelta | |
| 7 | |
| 8 yearmonth = sys.argv[1] | |
| 9 if yearmonth == 'prevmonth': | |
| 10 now = datetime.now() | |
| 11 yearmonth = (now - timedelta(days=now.day)).strftime('%Y%m') | |
| 12 year, month = re.search(r'^(\d{4})(\d{2})$', yearmonth).groups() | |
| LEFT | RIGHT |