线
aux=matriz;
不会复制
matriz,而只是创建对
matriznamed的新引用
aux。你可能想要
aux=matriz[:]
假设
matriz是简单的数据结构,它将进行复制。如果比较复杂,则应使用
copy.deepcopy
aux = copy.deepcopy(matriz)
顺便说一句,您不需要在每个语句后使用分号,python不会将它们用作EOL标记。

线
aux=matriz;
不会复制
matriz,而只是创建对
matriznamed的新引用
aux。你可能想要
aux=matriz[:]
假设
matriz是简单的数据结构,它将进行复制。如果比较复杂,则应使用
copy.deepcopy
aux = copy.deepcopy(matriz)
顺便说一句,您不需要在每个语句后使用分号,python不会将它们用作EOL标记。