How to use isinstance to check if variable is an instance of a class in Python

1 Answer

0 votes
class Test:
    def me(self):
        print("class Test")

o = Test()

if isinstance(o, Test):
    print("yes")


'''
run:
 
yes

'''

 



answered Nov 16, 2018 by avibootz
...