![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python疑难
「已注销」
这个作者很懒,什么都没留下…
展开
-
小白python疑难|IndentationError: unexpected indent
python学习python,出现了第一个错误。File “<pyshell#113>”, line 2thistuple = (“apple”, “banana”, “cherry”)^IndentationError: unexpected indent解决方法:把变量“thistuple”前面的空格去掉即可。因为python的缩进规则比较严格,所以不要随便加空格缩进...原创 2019-02-04 21:23:46 · 493 阅读 · 0 评论 -
小白python疑难|TypeError: 'tuple' object does not support item assignment
1.出现的错误:Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> thistuple[1] = "blackcurrant"TypeError: 'tuple' object does not support item assignment2.解决方法:...原创 2019-02-05 12:23:00 · 2011 阅读 · 0 评论 -
小白python疑难|TypeError: instance has no next() method
1.代码如图所示>>> class MyNumbers: def __iter__(self): self.a = 1 return self def __next__(self): if self.a <= 20: x = self.a self.a += 1 return x else: raise StopIteratio...原创 2019-02-07 15:31:53 · 1686 阅读 · 0 评论 -
小白python疑难|SyntaxError: Non-ASCII character '\xe5' in file
**1.出现的错误:**在sublime text3 编辑python代码的时候出现了错误SyntaxError: Non-ASCII character '\xe5' in file C:\Users\dell\Desktop\name.py.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0...原创 2019-02-09 09:08:09 · 499 阅读 · 0 评论 -
小白python疑难|File "[Decode error - output not utf-8]
1.出现的错误:sublime text3编写代码File "[Decode error - output not utf-8] ^SyntaxError: invalid syntax2.解决方法:在if语句后面加上英文冒号,代码就可以正常运行了。(1)出错的代码(2)正确的代码for alien in aliens[0:3]: if alien['color...原创 2019-02-12 21:05:42 · 1648 阅读 · 0 评论 -
小白python疑难|NameError: name 'Hello' is not defined
1.显示的错误message = input("Tell me something, and I will repeat it back to you: ") File "&lt;string&gt;", line 1, in &lt;module&gt;NameError: name 'Hello' is not defined2.出错的代码message原创 2019-02-13 09:48:43 · 5492 阅读 · 0 评论 -
小白python疑难|Source Must be saved OK to save?
1.出现错误:python 总是显示Source Must be saved OK to save?,无法保存代码文件responses = {}# 设置一个标志,指出调查是否继续polling_active = Truewhile polling_active: # 提示输入被调查者的名字和回答 name = raw_input("\nWhat is your name?")...原创 2019-02-13 20:22:49 · 15916 阅读 · 8 评论