Answers for "check if type in list"

0

python check if list

if isinstance(ini_list1, list):
  print("your object is a list !")
else:
    print("your object is not a list")
Posted by: Guest on December-22-2021
0

how to check type inside a list in python

In [3]: lst = (1,2,3)

In [4]: all(isinstance(n, int) for n in lst)
Out[4]: True

In [5]: lst = (1,2,'3')

In [6]: all(isinstance(n, int) for n in lst)
Out[6]: False
Posted by: Guest on November-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language