arrays - Python accesses multiple lists in a nested list. What's going wrong? -


python doesn't support multidimensional arrays, thought workaround easy enough. it's not working though. here's code

mat = [ [ none ] * 3 ] * 3 mat[0][0] = 1 return mat 

output

[[1, none, none], [1, none, none], [1, none, none]] 

why changing mat[1][0] , mat[2][0]? if ask print mat[0][0] gives me 1 should.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -