기술 성공, 실패 기록소

[0 for _ in range(10)] 본문

프로그래밍언어/python

[0 for _ in range(10)]

sunlab 2022. 4. 23. 23:52
728x90

https://stackoverflow.com/questions/15654800/what-is-the-difference-between-0-for-in-range10-for-in-range10-and

 

What is the difference between [[0 for _ in range(10)] for _ in range(10)] and [0 for _ in range(10)] * 10?

>>> CM = [[0 for _ in range(10)]] * 10 >>> CM [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ...

stackoverflow.com

 

'프로그래밍언어 > python' 카테고리의 다른 글

python thread  (0) 2022.04.23
파이썬(python) Multiprocessing  (0) 2022.04.22
python pool  (0) 2022.04.22
python super 명령어  (0) 2022.04.20
logging 사용법  (0) 2022.01.01