Created
December 30, 2016 19:42
-
-
Save error454/364de1ec22c7d747745d7e043eeeb3d6 to your computer and use it in GitHub Desktop.
52 Week Photo Challenge Text Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Used to generate text to post in the description of a Flickr | |
# group for a 52 week photo challenge. | |
# | |
# It will generate text like this: | |
# Week 01: 01-01 - 01-07 | |
# Week 02: 01-08 - 01-14 | |
# Week 03: 01-15 - 01-21 | |
# For an entire year. | |
from datetime import date, timedelta | |
# Set this to the day before the date you're interested in | |
# I'm generating text for the year of 2017, so the day before | |
# is Dec 31st 2016. | |
d = date(2016,12,31) | |
for i in range(1, 53): | |
start = d + timedelta(1) | |
end = start + timedelta(6) | |
d = end | |
print "Week " + str(i).zfill(2) + ": " + start.strftime('%m-%d') + " - " + end.strftime('%m-%d') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment