Answers for "python check type data if"

0

how to check if a variable in python is a specific data type

isinstance(variable_name, class_name) #eg. isinstance(age, int) will return True
Posted by: Guest on December-10-2020
1

check datatype python

a = 123
 
b = 'Hello'
 
print('Is a an instance of str?', isinstance(a, str))
print('Is b an instance of str?', isinstance(b, str))
Posted by: Guest on July-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language