Answers for "python create variable with dynamic name"

4

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'
Posted by: Guest on September-03-2020
1

python dynamic variable name

name = "a"
value = True
a_dictionary = {name: value}
print(a_dictionary["a"])
Posted by: Guest on November-02-2020

Code answers related to "python create variable with dynamic name"

Python Answers by Framework

Browse Popular Code Answers by Language