I am very new to python, so please forgive any basic mistakes. I took this block of code from a website (and it looks fairly straightforward) so I thought it would work. Basically, I want this code block to print out all the dates between 2015 and 2016. So far as I can tell, the indentation looks fine. I've tried adjusting the indentations as well, but I haven't had any luck in getting this to work. Any help would be greatly appreciated.
import calendar
cal = calendar.Calendar()
for year in range(2015,2016):
for month in range(1,13):
monthdays = [d for d in cal.itermonthdays(year,month) if d != 0]
for day in monthdays:
r = str(year) + str(month) + str(day)
print(r)
Whenever the code runs, I get this error:
>>> for year in range(2015,2016):
... for month in range(1,13):
File "<stdin>", line 2
for month in range(1,13):
^
IndentationError: expected an indented block
>>> monthdays = [d for d in cal.itermonthdays(year,month) if d != 0]
>>> for day in monthdays:
... r = str(year) + str(month) + str(day)
File "<stdin>", line 2
r = str(year) + str(month) + str(day)
^
IndentationError: expected an indented block
Thanks in advance.