我使用的是Python 3.5,但本书正在教2.7(打败我为什么在2016年)
使用Python学习Predictive Analytics由Ashish Kumar于2016年2月15日
>>> data=open(filename,'r')
>>> cols=data.next().strip().split(',')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
cols=data.next().strip().split(',')
AttributeError: '_io.TextIOWrapper' object has no attribute 'next'
>>>
Run Code Online (Sandbox Code Playgroud)
我已经读过这个 AttributeError:'_io.TextIOWrapper'对象没有属性'next'python ,我仍然不知道如何让它在Python 3.5 GUI shell中工作.
到目前为止,我理解Python 3.5我必须使用.__next__; 对于Python 2.7 .next.