Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: python check if int 
Python :: pandas count rows in column 
Python :: how to make a venv python 
Python :: tqdm progress bar python 
Python :: list to string 
Python :: subprocess.check_output python 
Python :: numpy matrix power 
Python :: else if in django template 
Python :: tkinter prevent window resize 
Python :: tkinter widget span multiple colums 
Python :: split string and convert to int python 
Python :: chrome driver in python selenium not working 
Python :: plot size 
Python :: access google transalte pandas 
Python :: python column multiply 
Python :: django month name from month number 
Python :: creating a list in python 
Python :: copy string python 
Python :: how to insert item last in list python 
Python :: summary in python 
Python :: python to excel 
Python :: pandas dataframe unique multiple columns 
Python :: how to capitalize the first letter in a list python 
Python :: find length of text file python 
Python :: python get memory address 
Python :: Action based permissions in Django Rest V3+ 
Python :: valor absoluto en python 
Python :: list comprehension python if 
Python :: max date by group pandas 
Python :: python function returns function 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =