Name 'xrange' is not defined in Python 3 [

2019-03-17 21:02发布

This question already has an answer here:

I try to execute following code but can't with mistake: name 'xrange' is not defined

pages = (
    requests.get(
        build_group_request({
            "offset": WINDOW_SIZE * i,
            "count": WINDOW_SIZE,
            "fields": "sex,interests,bdate"
        })
    ).json()['response']['items']
    for i in xrange(int(float(COUNT) / 100 + 1))
)

1条回答
你好瞎i
2楼-- · 2019-03-17 21:31

You're probably using Python3, where xrange has become range.

查看更多
登录 后发表回答