
Python各种报错
Python告诉我错哪了
豪冷啊
@Haomissyou,iOS开发工程师,个人作品:小五笔,小笔记,小汉字,小挑战,小编辑器等等
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python UnicodeDecodeError: ‘gbk‘ codec can‘t decode character ‘\xa5‘ in position 0
这个错误出现的场景是这样的:通过request获取网页内容使用bs4解析数据在把数据写入文件时出现了这个错误应该是编码问题。原创 2024-02-20 18:44:59 · 569 阅读 · 0 评论 -
Python UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa4 in position 49
这个错误出现的场景是这样的:我把一个在 Mac 电脑生成的.txt文件拷贝到了 Windows 电脑上在读取.txt文件内容时出现了这个错误应该是编码问题。原创 2024-02-20 18:38:09 · 649 阅读 · 0 评论 -
Python TypeError: ‘str‘ object is not callable
Python TypeError: 'str' object is not callable原创 2022-05-23 15:22:17 · 418 阅读 · 0 评论 -
Python IndentationError: unindent does not match any outer indentation level
Python IndentationError: unindent does not match any outer indentation level原创 2022-04-06 11:09:38 · 856 阅读 · 0 评论 -
Python UnboundLocalError: local variable ‘str‘ referenced before assignment
UnboundLocalError: local variable 'str' referenced before assignment原创 2022-03-08 15:00:32 · 6846 阅读 · 2 评论 -
Python UnboundLocalError: local variable 'xxx' referenced before assignment
全局变量 与 局部变量定义了一个全局变量arr = []在方法内使用时:def main(): if len(arr) == 0: f = open('log.txt','r') arr = list(f.readlines()) f.close()这样报错:Traceback (most recent call last):...原创 2020-03-10 11:56:29 · 1173 阅读 · 2 评论