Python: Create Array Objects Dynamically -
this question has answer here:
- creating multiple variables [duplicate] 2 answers
i want dynamically create arrays variable names array. have:
array1 = ['a', 'b', 'c']
i want programatically create new array each value in array1 (where not know how many values in array1 , not know names in there) using names provided in array1. give me:
= [] b = [] c = []
when array1 = [a,b,c]
, lose information names of variables used instantiate array, i'll assume meant array1=['a','b','c']
. in python, use dict
ionary solve issues related this. using dictionary, can have mapping 'a'
empty list
so:
array1 = ['a','b','c'] dicty = {} in array1: dicty[i] = []
if doesn't solve problem, please give me more information problem trying solve.
Comments
Post a Comment