Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to check if a list is nested or not

In [11]: a = [1, 2, 3]

In [12]: b = [[1], [2], [3]]

In [13]: any(isinstance(i, list) for i in a)
Out[13]: False

In [14]: any(isinstance(i, list) for i in b)
Out[14]: True
Comment

PREVIOUS NEXT
Code Example
Python :: np.percentile 
Python :: how to display printed values without scientific notation python 
Python :: pandas data profiling 
Python :: python timedelta to seconds 
Python :: python grid 
Python :: how to unpivot dataframe pandas 
Python :: root mean square python signal 
Python :: program to print duplicates from a list of integers in python 
Python :: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997) 
Python :: back button django template 
Python :: matplotlib point labels 
Python :: how to load mnist dataset in python 
Python :: python network programming 
Python :: calculate percentile pandas dataframe 
Python :: generate random token or id in django 
Python :: python user input 
Python :: python exam questions pdf 
Python :: python mode 
Python :: Find the title of a page in python 
Python :: python default dic 
Python :: django sessions 
Python :: print out a name in python 
Python :: pyplot new figure 
Python :: multiple bar graph in python 
Python :: Python How To Check Operating System 
Python :: python while loop 
Python :: get index of value in list if value meet condition python 
Python :: most frequent word in an array of strings python 
Python :: discord.py mention user 
Python :: aws lambda environment variables python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =