这是我的代码:
import requests
req = requests.post('<a href="https://en.wikipedia.org/w/index.php">https://en.wikipedia.org/w/index.php</a>', data = {'search':'Nanotechnology'})
req.raise_for_status()
with open('Nanotechnology.html', 'wb') as fd:
for chunk in req.iter_content(chunk_size=50000):
fd.write(chunk)
这给了我一个错误:
Exception has occurred: InvalidSchema
No connection adapters were found for '<a href="https://en.wikipedia.org/w/index.php">https://en.wikipedia.org/w/index.php</a>'
File "/Users/lik20/Downloads/request/downloadingawebpage.gyp", line 3, in <module>
req = requests.post('<a href="https://en.wikipedia.org/w/index.php">https://en.wikipedia.org/w/index.php</a>', data = {'search':'Nanotechnology'})
这是为什么?我如何修复它
必须在
req
变量中输入站点的URL作为第一个参数,而不是HTML结构的一部分相关问题 更多 >
编程相关推荐