Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

initialize a 2d list python

>>> y = [['' for i in range(3)] for j in range(3)]
[['', '', ''], ['', '', ''], ['', '', '']]
>>> y[0][0]=1
>>> print(y)
[[1, '', ''], ['', '', ''], ['', '', '']]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #initialize #list #python
ADD COMMENT
Topic
Name
1+9 =