Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これはおそらく非常に基本的なことですが、python 3 でネストされたリストをナビゲートするのに問題があります。
list1 = [[0]*3]*3 list1[0][1] = 1 print(list1)
出力を生成します
[[0, 1, 0], [0, 1, 0], [0, 1, 0]]
出力が
[[0, 1, 0], [0, 0, 0], [0, 0, 0]]
なぜこうなった?