Let's say I want to create a lot of instances of a class but don't want to write the variable name down for every instance.
What I want:
value1 = class(value1)
value2 = class(value2)
.
.
.
My idea was:
list = ['One','Two','Three']
for value in list:
value = class(value)
The result is not what I wanted. Python creates the variable 'value' and overrides it with the values of the list.
I'm sorry to ask such a basic question, but I'm not sure how to handle this.
listor adict, in this case, alistseems appropriatevalues = [class(x) for x in list]