Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to create multiple variables in a loop python

# i gets added to the end of the var name
i = 1
for n in range(5):
    globals()["w" + str(i)] = ###Do what you want here
    i += 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #multiple #variables #loop #python
ADD COMMENT
Topic
Name
1+2 =