IndexError: list index out of range when iterating two webelements lists

后端 未结 3 1287
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 06:09

I am trying to print the result on the terminal but getting this error message:

IndexError: list index out of range

Below is the code, tha

3条回答
  •  隐瞒了意图╮
    2020-12-12 06:57

    You are trying to access the list with the length of it instead of the iterator variable i

    print(f"{names[num_page_items].text} : {address[num_page_items].text}")
    

    to

    print(f"{names[i].text} : {address[i].text}")
    

提交回复
热议问题