【发布时间】:2018-08-17 11:16:02
【问题描述】:
我正在尝试运行以下代码:
Headers=requests.get('https://coinmarketcap.com').headers
CookieDough=Headers['Set-Cookie']
Headers="""\"{
":authority":"coinmarketcap.com",
":method":"POST",
":path":"/login",
":scheme":"https",
"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"accept-encoding":"gzip, deflate, br",
"accept-language":"en-US,en;q=0.9",
"cache-control":"max-age=0",
"content-length":"743",
"content-type":"application/x-www-form-urlencoded",
"cookie":\""""+CookieDough+"""\",
"origin":"https://coinmarketcap.com",
"referer":"https://coinmarketcap.com",
"upgrade-insecure-requests":"1",
"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
}\""""
print(json.loads(Headers, strict=False))
在过去的一个线程中,有人在 python 2.7 上运行了此代码并且它运行成功,但是当我在我的最后运行它时,python 3.6.4,它没有运行。它给了我以下错误:
json.decoder.JSONDecodeError: Extra data: line 2 column 2 (char 4)
我在 Sublime Text 3 Builder 上运行 Python 3.6.4。
谢谢
【问题讨论】:
标签: python python-3.x python-2.7 sublimetext3