M
M
Max Payne2016-04-29 16:22:36
Python
Max Payne, 2016-04-29 16:22:36

Why does the out of range error occur?

import requests
def parse(list, poffsetids):
    posts = []
    for i in list:
        posts.insert(i, requests.get('https://api.vk.com/method/wall.get', params={'owner_id': list[i - 1], 'offset': poffsetids[i - 1]}))
    return posts
print(parse([-61969218, -87156278, -43528947],[54, 56, 76]))

Getting
IndexError: list index out of range
Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iegor, 2016-04-29
@YardalGedal

list = [-61969218, -87156278, -43528947]
for i in [-61969218, -87156278, -43528947]:
I think it's clear now, do enumerate(list)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question