TypeError: object of type 'zip' has no len()、'zip' object is not subscriptable
2019-08-20 20:36
2176 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Moelimoe/article/details/99881373
TypeError: object of type ‘zip’ has no len()、‘zip’ object is not subscriptable
zip 对象没有length属性不可以遍历代码报错:
print(len(training_data)) # TypeError: object of type 'zip' has no len() print(training_data[0][0].shape) # TypeError: 'zip' object is not subscriptable
源代码部分代码:
test_data = zip(test_inputs, te_d[1]) return (training_data, validation_data, test_data)
解决方法:zip对象用list包装即可
test_data = list(zip(test_inputs, te_d[1])) return (training_data, validation_data, test_data)
相关文章推荐
- TypeError: object of type 'zip' has no len()、'zip' object is not subscriptable
- 解决Python中出现的TypeError: object of type 'zip' has no len()
- object of type 'zip' has no len()
- TypeError: object of type 'NoneType' has no len()
- python - 数据库 及 TypeError: 'zip' object is not subscriptable
- TypeError: object of type 'NoneType' has no len()
- TypeError: object of type 'Response' has no len() 这是为何?
- BeautifulSoup4----TypeError: object of type 'Response' has no len()
- TypeError: Object of type 'int32' is not JSON serializable
- python-TypeError: Object of type 'Decimal' is not JSON serializable 报错
- Python3 flask 解析post的json数据时报错,TypeError: Object of type 'bytes' is not JSON serializable
- TensorFlow1.0 运行报错 AttributeError: type object 'NewBase' has no attribute 'is_abstract'
- 使用numpy库报错,TypeError: Object of type 'int64' is not JSON serializable.
- “TypeError: 'dict_keys' object is not subscriptable”
- 关于 "Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function" 的解决方案
- Anaconda3.6安装好Hyperopt包后,调用过程中出现错误TypeError”generator”object is not subscriptable。
- python2.7web代码用python3.6运行时,浏览器发送请求报错TypeError: Object of type 'bytes' is not JSON serializable的解决办法
- python错误:TypeError: 'generator' object is not subscriptable
- Uncaught TypeError: Property 'submit' of object # is not a func
- Python开发:AttributeError: 'Class_Of_LoanUseCase' object has no attribute '_type_equality_funcs'