Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.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 - Fatal编程技术网

Python 3.x 尝试用python下载多个文件并报告是否成功

Python 3.x 尝试用python下载多个文件并报告是否成功,python-3.x,Python 3.x,所以我正试图从一个网站上下载文件(包括图片和文档)。我必须把这些下载到一个特定的文件夹。到目前为止,我已经: images = re.findall("/([^/]+\.(?:jpg|gif|png))", html) output = open("output.txt","a+") output.write("\n" + f"[+] {len(images)} Images Found:" + "\n") for images in images: output.write(image

所以我正试图从一个网站上下载文件(包括图片和文档)。我必须把这些下载到一个特定的文件夹。到目前为止,我已经:

images = re.findall("/([^/]+\.(?:jpg|gif|png))", html)
output = open("output.txt","a+")
output.write("\n" + f"[+] {len(images)} Images Found:" + "\n")
for images in images:
    output.write(images + "\n")
    output.write("Beginning file download with urllib2..." + "\n")
    imageurl = "images"
    urllib.request.urlretrieve(url, "/downloads")
我如何保持文件名与特定文件类型的网站上的文件名相同

这只是处理图像的代码的一小部分。

可能重复的