运行一下程序,出现SyntaxError: invalid character in identifier,求解决方法
import os,sys
class programmer(object):
hobby="play computer"
def __init__(self,name,age,weight):
self.name=name
self._age=age
self.__weight=weight
@classmethod
def get_hobby(cls):
return cls.hobby
@property
def get_weight(self):
return self.__weight
def self_introduce(self):
print("My name is %s \nI am %s yeas old\n"%(self.name, self._age))
if __name__=='__main__':
prog=programmer('Albert',25,80)
print(dir(prog))
print(programmer.get_hobby())
print(prog.get_weight)
print(prog._programmer__weight,prog.self_introduce)