mnist中遇到的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a870542373/article/details/80978082

一、TypeError: object of type ‘zip’ has no len()

TypeError: ‘zip’ object is not subscriptable

解决办法:将:training_data = zip(training_inputs, training_results)

                改为:training_data = list(zip(training_inputs, training_results))

            这是因为python2与python3版本的问题,在python3中要先list(zip())

二、NameError: name 'xrange' is not defined

还是版本问题,在Python 3中,range()与xrange()合并为range( )

所以改为range()

三、AttributeError: 'collections.defaultdict' object has no attribute 'iteritems'

Python3中:iteritems变为items


猜你喜欢

转载自blog.csdn.net/a870542373/article/details/80978082