我一直试图解决这个错误很长时间,并尝试了许多方法来解决它。请帮我做同样的事。代码和错误在屏幕截图中。你知道吗
url = "https://www.moneycontrol.com/financials/adani%20ports/balance-
sheetVI/MPS"
response = requests.get(url, timeout=240)
response.status_code
content = response.json()
content.keys()
回溯:
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
<ipython-input-90-f7433ffb5f41> in <module>()
1 url = "https://www.moneycontrol.com/financials/adani%20ports/balance-sheetVI/MPS"
2 response = requests.get(url, timeout=240)
----> 3 content = response.json()
4 content
3 frames
/usr/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
355 obj, end = self.scan_once(s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) from None
358 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
我认为您应该添加一些头并确定您接受json数据。 请尝试以下代码:
相关问题 更多 >
编程相关推荐