为什么对于cycle,更改元组值(Python)

2024-10-03 23:20:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下代码:


meses=('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre') for meses in meses: print("- ",meses) print (meses)

迭代之后,元组现在只有一个值:Diciembre 我试过枚举,效果很好,但是我想知道,For循环发生了什么,为什么要改变元组的大小?。你知道吗


Tags: 代码元组printmayoagostomesesenerojunio