Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #type #list #python
ADD COMMENT
Topic
Name
6+8 =