How Can I Make A 2d Array With Existing Lists?
for instance, i have a txt data called 'mazeline' like this: abcd cdae korp So i first made 3 lists: mazeline = readmaze.split() mline0 = list(mazeline[0]) mline1 = list(mazelin
Solution 1:
Just put the lists inside another list
res = [mline0, mline1, mline2]
more simply, you can skip the intermediate variables and use a list comprehension
res = [list(mline) for mline in readmaze.split()]
Post a Comment for "How Can I Make A 2d Array With Existing Lists?"