[Tutor] Help with range of months spanning across years
Sean Carolan
scarolan at gmail.com
Wed Feb 2 00:19:13 CET 2011
I have a function that accepts four arguments, namely startmonth,
startyear, endmonth, and endyear. For example:
startmonth = 8
startyear = 2009
endmonth = 1
endyear = 2010
What would be the most straightforward way to create a list of
year/month pairs from start to end? I want to end up with a list of
tuples like this:
mylist = [(2009, 8), (2009, 9), (2009, 10), (2009, 11), (2009, 12), (2010, 1)]
More information about the Tutor
mailing list