You can use the inspect
module to get the class name in Python:
main.py99 chars7 lines
This code will output 'MyClass'
. It uses the getmembers
function from the inspect
module to get all the members of the MyClass
object that are classes, and then takes the first one (which in this case is the only one) and retrieves its name.
gistlibby LogSnag