class StudentDoc: def __init__(self,xh,name,zy,fs): self._xh=xh self._name=name self._zy=zy self._fs=fs def info(self): print(f'学号:{self._xh}') print(f'姓名:{self._name}') print(f'专业;{self._zy}') print(f'python分数:{self._fs}') def get_fs(self): return self._fs def xg_fs(self,newfs): self._fs=newfs return newfs def main(): a1 = StudentDoc('445990426', 'Anjor', 'python', '88') a1.xg_fs(66) a1.info() if __name__ == '__main__': main()
from student import StudentDoc as www u1 = www('123','456','789','0') u1.xg_fs(66) u1.info() u2 = www('321','654','987','00') u2.info()