python get type class name
type(x).__name__
python get type class name
type(x).__name__
how to get name of class in class python
class SillyClassName:
@classmethod
def my_name(cls_):
return cls_.__name__
def class_name(self):
# self.__class__ gets the current class
# .__name__ gets the name
return self.__class__.__name__
SillyClassName.my_name()
# prints SillyClassName
inst = SillyClassName()
inst.class_name()
# prints SillyClassName
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us