我正在尝试循环浏览从 2012 年和 11 月开始的月份列表,一直到当前年份和月份。
start_year = "2012"
start_month = "November"
month = start_month
year = start_year
# some sort of for loop or cycle here
try:
with open('{} {}.csv'.format(month, year)):
CSVFile = True
if CSVFile:
print "do something cool here"
except IOError:
CSVFile = False
print ""
任何有关如何实现此目标或建议的建议或建设性意见将不胜感激。非常感谢