存储对象实例列表非常简单
class MyClass(object): def __init__(self, number): self.number = numbermy_objects = []for i in range(100): my_objects.append(MyClass(i))# laterfor obj in my_objects: print obj.number
欢迎分享,转载请注明来源:内存溢出
存储对象实例列表非常简单
class MyClass(object): def __init__(self, number): self.number = numbermy_objects = []for i in range(100): my_objects.append(MyClass(i))# laterfor obj in my_objects: print obj.number
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)