Answers for "create instances of a class in a for loop"

0

create instances of a class in a for loop

objs = [MyClass() for i in range(10)]
for obj in objs:
    other_object.add(obj)

objs[0].do_sth()
Posted by: Guest on August-26-2021

Code answers related to "create instances of a class in a for loop"

Python Answers by Framework

Browse Popular Code Answers by Language