内置函数 object() 返回一个空对象。该对象是所有类的基类。它包含默认的内置属性和方法。不能向此对象添加新的属性或方法。
o = object() #where o is the object
object() 函数不接受任何参数。
object() 函数返回一个没有特征的对象。此对象作为所有类的基类。
test = object()
print(type(test))
print(dir(test))
输出
test = object() print(type(test)) print(dir(test))
# declaring the objects of class object
obj1 = object()
obj2 = object()
# checking for object equality
print ("Is obj1 equal to obj2 : " + str(obj1 == obj2))
# trying to add attribute to object
obj1.name = "GeeksforGeeks"
输出
Is obj1 equal to obj2 : False