Drkcore

02 09 2011 Python Tweet

Pythonのリストのリストでちょいはまる

すっかり忘れてたがこんなのです。

shallow = [[1,2,3]] * 3
shallow[1][1] = 0
shallow # [[1, 0, 3], [1, 0, 3], [1, 0, 3]]
deep = [[1,2,3 ] for f in [1,2,3]]
deep[1][1] = 0
deep # [[1, 2, 3], [1, 0, 3], [1, 2, 3]]

という備忘録

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021