How does python determine whether a specified class exists?

class A():
    pass

if xxxx("A"):
    print("A exists")
else:
    print("A not exists")
Mar.28,2021

you can use the method of comparing hacky:

def is_class_exists(class_name):

    if not class_name.isidentifier():
        return False

    try:
        return isinstance(eval(class_name), type)
    except NameError:
        return False
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48cf0-44cd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48cf0-44cd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?