I am testing a simple nested for loop that combines year and month
year_time = range(2014, 2016)
month_time = [
'0101', '0201', '0301', '0401',
'0501', '0601', '0701', '0801',
'0901', '1001', '1101', '1201'
]
for year_time in year_time:
for month_time in month_time:
print (str(year_time) + month_time)
The ideal output is 20140101, 20140201 ... 20151101, 20151201
. However, the actual output is 20140101, 20140201 ... 20151
.
Where do I get wrong?
source https://stackoverflow.com/questions/71915722/nested-for-loop-is-incorrect-for-the-second-number
Comments
Post a Comment