Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to create an empty 2d list in python

#To create an empty 2d list of size n
l=[]
for i in range(n):
	l.append([])
#To create an 2d list of size rows and columns
l=[[0 for j in range(len(column))]for i in range(len(row))]
Comment

PREVIOUS NEXT
Code Example
Python :: how to get current time in milliseconds in python 
Python :: get home directory in windows python os 
Python :: convert list to string python 
Python :: python edit text file 
Python :: python argparse 
Python :: remove rows or columns with NaN value 
Python :: dataframe x y to geodataframe 
Python :: Make solutions faster in python 
Python :: the four pillars of Op in Python 
Python :: matplotlib title not fully visible 
Python :: python request example 
Python :: plotly not showing in colab 
Python :: glob read multiple images 
Python :: pandas combine two data frames with same index and same columns 
Python :: what is r strip function in python 
Python :: how do you create a countdown using turtle python 
Python :: list to string python 
Python :: install python 3 on mac 
Python :: Appending pandas dataframes generated in a for loop 
Python :: how to graph with python 
Python :: pyspark select without column 
Python :: python head function show all columns 
Python :: python rock paper scissor 
Python :: py pause script 
Python :: how to print hello in python 
Python :: pandas count distinct 
Python :: python check if string is number 
Python :: python read column from csv 
Python :: python remove duplicates from list 
Python :: discord python bot require one of two roles for command 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =