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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -