Python:无法识别next() [英] Python: next() is not recognized

查看:93
本文介绍了Python:无法识别next()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在python中执行next(ByteIter, '')<<8时,出现名称错误提示

When I do next(ByteIter, '')<<8 in python, I got a name error saying

未定义全局名称'next'"

"global name 'next' is not defined"

我猜测由于python版本无法识别此功能?我的版本是2.5.

I'm guessing this function is not recognized because of python version? My version is 2.5.

推荐答案

来自文档

next(iterator [,默认])

next(iterator[, default])

Retrieve the next item from the iterator by calling its next() method. 
If default is given, it is returned if the iterator is
exhausted, otherwise StopIteration is raised.

New in version 2.6.

是的,它确实需要2.6版.

So yes, it does require version 2.6.

这篇关于Python:无法识别next()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆