
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the class name of an instance in Python?
The following code shows how to get the class name of the instance in question.
Example
class Number: def __init__(self, number): self.number = number n1 = Number(1) print n1.__class__ print n1.__class__.__name__
Output
This gives the output
__main__.Number Number
- Related Questions & Answers
- How to implement an instance method reference using a class name in Java?
- How many ways can get the instance of a Class class in Java?
- How to create an instance of an abstract class in Kotlin?
- Get the fully-qualified name of an inner class in Java
- Get the unqualified name of a class in Java
- How to check if an object is an instance of a Class in JavaScript?
- Class & Instance Attributes in Python
- How to get css class name using Selenium?
- Get the fully-qualified name of a class in Java
- Python How to get function name?
- Get the class name for various objects in Java
- How to get the code name and product name of the browser in JavaScript?
- How to create an instance of an anonymous interface in Kotlin?
- Get Canonical Name for a class in Java
- How to get the name of the current executable in C#?
Advertisements