simplejson.scanner.JSONDecodeError: Extra data: line 1 column 22089 - line 1 column 22090
我的代码
page = requests.get("http://www.sogou.com/kmap?query=%E9%99%88%E5%A5%95%E8%BF%85&from=relation&id=")
pageJson = simplejson.loads(page.text)
报了如下错误:
Traceback (most recent call last):File "D:/pythonCode/crawl/DownloadSogouTupu.py", line 7, in <module>pageJson = simplejson.loads(page.text)File "C:\Users\denglinjie\AppData\Local\Programs\Python\Python35-32\lib\site-packages\simplejson\__init__.py", line 516, in loadsreturn _default_decoder.decode(s)File "C:\Users\denglinjie\AppData\Local\Programs\Python\Python35-32\lib\site-packages\simplejson\decoder.py", line 377, in decoderaise JSONDecodeError("Extra data", s, end, len(s))
simplejson.scanner.JSONDecodeError: Extra data: line 1 column 22089 - line 1 column 22090 (char 22088 - 22089)
问题原因:
url返回的数据行的末尾多了一个^M,导致simpleJson解析失败,去掉最后的字符就可以了:
pageJson = simplejson.loads(page.text[0:-1])
simplejson.scanner.JSONDecodeError: Extra data: line 1 column 22089 - line 1 column 22090相关推荐
- raise JSONDecodeError(“Extra data“, s, end) json.decoder.JSONDecodeError: Extra data: line 1 column
raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line ...
- (已解决)json.decoder.JSONDecodeError: Extra data: line 1 column 47 (char 46)
问题描述 *json.load(file)*出现上述错误. 原因是file中包含不止一条记录.json.load函数只能解析一条记录. 解决方案 将多条记录强行封装为一条,便可读取. Referenc ...
- 【raise JSONDecodeError(“Extra data“, s, end)】
前因 原本想爬取点股票的数据分析分析,然后就遇到了这个坑,已经有段时间没再接触python,语法都差不多忘光了,所幸python简单的东西不难. 教程 python requests.get(-).j ...
- Json错误JSONDecodeError: Extra data解决方案
(作者:www.data-master.net 数据极) 问题描述: 使用以下代码转换字符串为json格式时,出现JSONDecodeError: Extra data的错误: import json ...
- Extra data: line 1 column 342004 (char 342003)
Extra data: line 1 column 342004 (char 342003)
- Extra Data after Last Expected Column:hawq建外表load数据报错
背景:使用sqoop import 才oracle抽数据入HDFS后,通过pxf建立hawq外表,查询数据报错 解决思路:1.从报错上看应该是数据源分割后字段数比目标表字段多,且pgadmin3里报错 ...
- Data truncation: Out of range value for column ‘quanity‘ at row 问题解决方案
Data truncation: Out of range value for column 'quanity' at row 问题解决方案 参考文章: (1)Data truncation: Out ...
- 使用mybatisPlus时,报错 Data truncation: Out of range value for column ‘id‘ at row 1
报错信息如下: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Out of range value for co ...
- Java Data truncation:Incorrect xxx value: ‘xxx‘ for column ‘xxx‘ at row 1问题
问题描述: Caused by: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect dateti ...
最新文章
- Gradle入门系列(4):创建二进制发布版本
- 如何改变本地git的根目录
- Adobe 中国区 "Adobe RIA 开发工程师认证考试" 正式发布
- Sharepoint java sdk_java – 使用JAX-WS将文件保存到Sharepoint服务器
- 关于有序二维矩阵查找和字符串替换的两道算法题
- Python __all__的作用
- linux捕获线程发出的信号,我可以在多线程(pthreads)应用程序中捕获SIGSEGV和其他信号并打印导致它的线程或所有线程的回溯吗?...
- 匆匆的一瞥,错过了一份正确的BIOS……,安装X64系统时错刷BIOS的彻底死机过程以及解决方法...
- Delphi 10.4.2 (RAD Studio 10.4.2 )安装教程图解
- android listview viewstub,Android中使用ViewStub提高布局性能
- 驱动外挂的原理及检测手段(自瞄篇)
- pulseaudio 播放卡顿的解决方法
- Hands-on Lab of Azure
- 河南省周口市安吉软件测试培训中心第一次软件测试课程-计算机基础理论论篇
- 天翼云云硬盘的磁盘模式及共享盘
- Referenced file contains errors (http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd)
- 用友系统客户端登录不上服务器,图文详解用友客户端连不上服务器解决方法.pdf...
- c语言设计程序之数组,软考程序员考点C语言程序设计之数组
- 网页设计标记工具——马克鳗
- 【深度干货】数据中心机柜综合布线