首页上一页 1 下一页尾页 2 条记录 1/1页
新手求助!!!出现JSONDecodeError
发表在Python视频课程答疑
2020-03-12
是否精华
是
否
版块置顶:
是
否
查了两天了一直没有解决!求解,感激不尽 import requests response = requests.get('https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date=2020-03-13&leftTicketDTO.from_station=BJP&leftTicketDTO.to_station=SHH&purpose_codes=ADULT') result = response.json() result = result["data"]["result"] for i in result: print(i) 运行后出现下面的错误: Traceback (most recent call last): File "C:/Users/hzw/Desktop/2581.py", line 4, in <module> result = response.json() File "F:\最初的梦想 to make it\最初的学习\lib\site-packages\requests\models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "F:\最初的梦想 to make it\最初的学习\lib\json\__init__.py", line 357, in loads return _default_decoder.decode(s) File "F:\最初的梦想 to make it\最初的学习\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "F:\最初的梦想 to make it\最初的学习\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Process finished with exit code 1