机器学习实战中遇到的python问题

当对着《机器学习实战》上面的代码敲时,有时会遇到一些错误,一些是版本问题,如下面的错误是2.1.2中的代码遇到的错误,


AttributeError:'dict' object has no attribute 'iteritems'


这是由于python升级版本所做的改变:

Remove dict.iteritems(), dict.iterkeys(), and dict.itervalues().

Instead: use dict.items(), dict.keys(), and dict.values() respectively.
介绍差别如下:
docs.python.org/release/3.1.3/whatsnew/3.0.html

你可能感兴趣的:(python)