我有一个for循环:
for x in range(1,13):
print ("This was the average temperature in month number " + str(x) + " in Boston, 2014: ", Boston_monthly_temp(x))
这打印出2014年波士顿的月平均气温,例如:
This was the average temperature in month number 1 in Boston, 2014: 26.787096774193547
一直到第12个月(12月):
This was the average temperature in month number 12 in Boston, 2014: 38.42580645161291.
总而言之,这个for循环产生12行.
但是,我无法弄清楚如何将这个“for”循环的结果存储到单个变量中,如(output_number_one).
我正在尝试将结果存储到单个变量中,因此我可以将变量(及其内容)转储/写入pickle文件,名为:
output.pkl