Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to create dynamic variable names in python

for x in range(0, 9):
    globals()['string%s' % x] = 'Hello'
# string0 = 'Hello', string1 = 'Hello' ... string8 = 'Hello'
 
PREVIOUS NEXT
Tagged: #create #dynamic #variable #names #python
ADD COMMENT
Topic
Name
2+6 =