Name 'xrange' is not defined in Python 3 [duplicate]

泪湿孤枕 提交于 2019-12-09 04:42:50

问题


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:


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



来源:https://stackoverflow.com/questions/31104416/name-xrange-is-not-defined-in-python-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!