Python 类与对象:学生信息类示例
class Student: def init(self, sid, name, height, sex): self.sid = sid self.name = name self.height = height self.sex = sex def print_info(self): print('学号:', self.sid) print('姓名:', self.name) print('身高:', self.height) print('性别:', self.sex)
原文地址: https://www.cveoy.top/t/topic/nZL0 著作权归作者所有。请勿转载和采集!