python class 通過類方法修改類屬性

‘’’ 通過類方法修改類屬性 ‘’’ class Person(object): country = ‘中國’ @classmethod def countryinfo(cls): pass @classmethod def changecountry(cls,newcountry): cls.country = newcountry print(‘此時的國籍是:’,cls.country) de
相關文章
相關標籤/搜索