请问这个问题出在哪里呢?

img


我的代码是import requests
res = requests.get('http://www.10086.cn/support/selfservice/help/sh/5018801_4073_8801.json')
data_dict = res.json()
print(data_dict)
问题报错:

Traceback (most recent call last):
File "D:\pycharm\各种文件 练习\01\q2.py", line 3, in
data_dict = res.json()
File "C:\Users\16123\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

大概是因为这个网址404 not found。

看一下get返回的结果吧~应该是空的,大概率是反爬了。设置一下header 吧