Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Python请求如何在不下载所有图像的情况下获取页面?_Python 3.x_Python Requests - Fatal编程技术网

Python 3.x Python请求如何在不下载所有图像的情况下获取页面?

Python 3.x Python请求如何在不下载所有图像的情况下获取页面?,python-3.x,python-requests,Python 3.x,Python Requests,我需要解析一个网页,它有很多图片,每个请求需要很多时间,因为它 我可以使用requests.get只获取html内容而不等待图像吗?当您获取页面时,您只下载页面本身 import requests url = 'https://stackoverflow.com/questions/40394209/python-requests-how-to-get-a-page-without-downloading-all-images' # This will yield only the HTML

我需要解析一个网页,它有很多图片,每个请求需要很多时间,因为它


我可以使用requests.get只获取html内容而不等待图像吗?

当您获取页面时,您只下载页面本身

import requests

url = 'https://stackoverflow.com/questions/40394209/python-requests-how-to-get-a-page-without-downloading-all-images'

# This will yield only the HTML code
response = requests.get(url)

print(response.text)

页面HTML包含对图像的引用,但是GET请求没有遵循它们。

对不起,我很愚蠢,有时会问一些非常愚蠢的问题。这只是javascript和地图加载。我会接受你的回答。难怪这个问题没有谷歌搜索结果。你知道,你不是唯一一个认为这些图片也被下载的人,哈哈