python - Using variables as index on list -
i have 2 lists:
list1 = [1, 3, 6, 8, 1, 61, 89, ...] # how list1 declared list2[1][3][6][8][1][61][89][...] # how want access data list2
list1
1 one-dimensional list undefined size (can have 1, 2 or infinite items)
list2
multi-dimensional (nested) list (can 2d or 3d or infinite)
i wanted use lists list2[list1[0]][list1[1]][list1[...]]
; want access data in list2
using data list1
.
i tried following got error
len(list2[list1])
how can access list2
's data using indexes in list1
?
len(list2[list1])
: trying index list2
using list1
while indexing in lists done using integers.
try: len(list2[list1[0]])
Comments
Post a Comment