有没有可能使用python获取网页的前几个内容,比如1K?
非常感谢!
发布于 2012-06-25 12:23:01
Requests库允许您在收到响应时对其进行迭代,因此您可以执行以下操作:
import requests
beginning = requests.get('http://example.com/').iter_content(1024).next()如果你只想要头文件,你可以使用http HEAD方法:
req = requests.head('http://example.com')https://stackoverflow.com/questions/11183371
复制相似问题