Answers for "rename a variable using .format in python"

0

rename a variable using .format in python

arraysDict = {}
for i in range(0,3):
    arraysDict['x{0}'.format(i)] = [1,2,3]

print arraysDict
# {'x2': [1, 2, 3], 'x0': [1, 2, 3], 'x1': [1, 2, 3]}
print arraysDict['x1']
# [1,2,3]
Posted by: Guest on August-20-2020
0

rename a variable using .format in python

arraysList = []
for i in range(0,3):
    arraysList.append([1,2,3])

print arraysList
# [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
print arraysList[1]
# [1, 2, 3]
Posted by: Guest on August-20-2020

Code answers related to "rename a variable using .format in python"

Python Answers by Framework

Browse Popular Code Answers by Language