Skip to content

Instantly share code, notes, and snippets.

@error454
Created December 30, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save error454/364de1ec22c7d747745d7e043eeeb3d6 to your computer and use it in GitHub Desktop.
Save error454/364de1ec22c7d747745d7e043eeeb3d6 to your computer and use it in GitHub Desktop.
52 Week Photo Challenge Text Generator
# 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