python how to use list of objects code example
Example: python list of objects
# Create a new class
class MyClass(object):
def __init__(self, number):
self.number = number
# Create a array to store your objects
my_objects = []
# Add 100 objects to array
for i in range(100):
my_objects.append(MyClass(i))