English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python Basic Tutorial

Python Flow Control

Fonctions en Python

Types de données en Python

Python File Operations

Python Objects and Classes

Python Date and Time

Advanced Python Knowledge

Python Reference Manual

Python object() usage and examples

Python built-in functions

The object() function returns an object with no features, which is the basis of all classes.

The syntax of object() is:

o = object()

object() parameters

The object() function does not accept any parameters.

object() return value

The object() function returns an object with no features.

Example: How does object() work?

test = object()
print(type(test))
print(dir(test))

Output result

<class 'object'>
__class__, __delattr__, __dir__, __doc__, __eq__, __format__, __ge__, __getattribute__, __gt__, __hash__, __init__, __le__, __lt__, __ne__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Here, an object is createdtest.

In the program, we usetype()Get the type of the object.

Similarly, we usedir()Get all properties. These properties (properties and methods) are common to all instances of Python classes.

Python built-in functions