
Python报错
湾区人工智能
会多国语言的海归
展开
-
NameError: name 'sys' is not defined
python 代码最前面添加:import sys 认识你是我们的缘分,同学,等等,记得关注我。 微信扫一扫关注该公众号原创 2018-11-01 10:00:39 · 16129 阅读 · 0 评论 -
AttributeError: 'dict' object has no attribute 'iteritems' .iteritems(): 修改为items()
Python报错AttributeError: 'dict' object has no attribute 'iteritems'源代码: for k,v in M.iteritems(): 修改: for k,v in M.items(): 认识你是我们的缘分,同学,等等,记得关注我。 微信扫一扫关注该公众号...原创 2018-11-01 14:57:41 · 2190 阅读 · 0 评论 -
AttributeError: module 'sys' has no attribute 'maxint'
sys.maxint改为sys.maxsize 认识你是我们的缘分,同学,等等,记得关注我。 微信扫一扫关注该公众号原创 2018-11-02 21:14:37 · 5365 阅读 · 0 评论 -
NameError: name 'random' is not defined
最前面添加import random 这行代码返回0-1之间的随机数random.random() 认识你是我们的缘分,同学,等等,学习人工智能,记得关注我。 微信扫一扫关注该公众号《湾区人工智能》...原创 2018-11-07 08:08:59 · 26893 阅读 · 3 评论 -
SyntaxError: Non-ASCII character '\xe7
Python2会出现这种问题解决方案:代码最前面添加# -*- coding:utf-8 -*-原创 2018-11-08 09:32:08 · 912 阅读 · 0 评论 -
sublime text下 Python 问题:TabError: inconsistent use of tabs and spaces in indentation
File "G:\ST\Python\code.py", line 52 while left < right and (nums[left] == nums[left+1]): ^TabError: inconsistent use of tabs and spac...原创 2018-09-06 09:32:04 · 2104 阅读 · 0 评论 -
共享个人整理的Python问题,有源码,分析过程,解决方案,还有时间戳做间隔
2018.10#2018-10-23 15:48:47 October Tuesday the 43 week, the 296 day SZ报错 File "/Users/apple/Documents/ST/python/Python_test.py", line 4 Out[5]: ^SyntaxError: invalid syntax...原创 2018-10-23 15:51:53 · 4506 阅读 · 2 评论 -
AttributeError: 'function' object has no attribute 'Document'报错解决
原因是函数名称和系统中的某个名称相同的,替换另外的名字就行了报错代码:#读取docx中的文本代码示例import docxdef docx(): file=docx.Document(filename) raw_words = '' #保存所有的单词 #输出每一段的内容 for para in file.paragraphs: raw...转载 2019-03-02 19:55:50 · 9853 阅读 · 0 评论 -
NameError: name 'words' is not defined
没有定义问题,一般确实没有东西,就要输出,才会报错。注意全局变量和局部变量问题修改方法,添加一个words=[] 就搞定了扫码关注,和德国海归一起学习人工智能...转载 2019-03-03 15:32:35 · 5260 阅读 · 0 评论