Python – How to Get the String Name of a Class python What method do I call to get the name of a class? Best Answer In [1]: class Test: ...: pass ...: In [2]: Test.__name__ Out[2]: 'Test' Related SolutionsPython – How to Get Class Name Since python 3.3, you can use the __qualname__ variable: class TestClass(): myName = __qualname__ Python Class – How to Get Class Object from Class Name String import sys getattr(sys.modules[__name__], "Foo") # or globals()['Foo'] Related Question
Best Answer