Answers for "check if object is of class python"

5

python check if class has function

class A:
  def func():
    pass
hasattr(A(), 'func')
Posted by: Guest on July-03-2020
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

Code answers related to "check if object is of class python"

Python Answers by Framework

Browse Popular Code Answers by Language