logo-MindMajix
PostPythonPython
k
kavya A

Posted on 21st June 2024|17 views

0
votes

Python Get Class Name

How to get a class name of an instance?

1 answers
Answers
P
persis crystal

Posted on 21st June 2024| views

Just go through this simple example which might help you

class human(object): 

def init(me,my_name): 

me.my_name=my_name 

def info(me) 

print "My name is {0}, I am a{1}".format(me.my_name,me.__class__.__my_name__) bob = human(name='Angel')

bob.info()

Output:

My name is Angel, I am a human

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number