[[+content_image]]
P
P
ptvalx2020-06-22 14:36:28
Python
ptvalx, 2020-06-22 14:36:28

How to create list [x][y] with string data of unknown size?

arr[0][0] = '1'
arr[0][1] = '2'
arr[1][0] = '3'
arr[1][1] = '4'

print(arr)

[['1','2'],['3','4']]


Tried but gives an error
arr = [[0] * len_y for i in range(len_x)]

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
E
Eugene Kuznetsov, 2020-07-02
@KEugene

Not quite clear. Do you want a two dimensional array? You get it. What's wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question