Answers for "how to check if a list is nested or not"

0

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
Posted by: Guest on October-28-2021

Code answers related to "how to check if a list is nested or not"

Python Answers by Framework

Browse Popular Code Answers by Language