import calendar
def getMothDate(year, month):
"""
返回某年某月的所有日期
:param year:
:param month:
:return:
"""
date_list = []
for i in range(calendar.monthrange(year, month)[1] + 1)[1:]:
str1 = str(year) + str("%02d" % month) + str("%02d" % i)
date_list.append(str1)
return date_list
year = 2019
month = 8
date_list = getMothDate(year, month)
for date in date_list:
print(date)