我有以下代码:
meses=('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre')
for meses in meses:
print("- ",meses)
print (meses)
迭代之后,元组现在只有一个值:Diciembre
我试过枚举,效果很好,但是我想知道,For循环发生了什么,为什么要改变元组的大小?。你知道吗
Tags:
循环变量的名称和列表名称相同。所以基本上
meses
是保存原始列表meses
最后一个值的循环变量。你知道吗相关问题 更多 >
编程相关推荐