通過object() 創(chuàng)建的對象是 Python 中最簡單的對象,它沒有任何屬性或方法,除了一些基礎(chǔ)的行為(如str、repr、eq等)。此外,object 的實例是不可變的,這意味著你不能向該對象添加屬性。 1 2 obj=object() obj.name="example"# 會報錯:AttributeError: 'object' object has no attribute 'name' ...
www.dbjr.com.cn/python/340423v...htm 2025-6-6