只是一个路过的询问...说我有一些课:class Student: def __init__(self, name, grade, school=None): self.name = name self.grade = grade self.school = school def enroll(self, school): self.school = school我知道我可以像这样调用对象的属性:x = Student("John Doe", 12)print( x.grade )print( x.name )但是有没有一种方法可以通过仅引用对象一次来从对象中顺序调用多个属性?也许是这样的:x.(grade,name)会返回:12 John Doe
添加回答
举报
0/150
提交
取消