在 Python 3.8.2 我下载文件:
import urllib.request
urllib.request.urlretrieve(url_address, file_name)
如何在不下载的情况下检查 url_address 上的文件是否可下载?我尝试使用try语句。它仅在无法下载文件时引发错误,但当来自给定 URL 地址的文件可下载时,它始终会下载。
在 Python 3.8.2 我下载文件:
import urllib.request
urllib.request.urlretrieve(url_address, file_name)
如何在不下载的情况下检查 url_address 上的文件是否可下载?我尝试使用try语句。它仅在无法下载文件时引发错误,但当来自给定 URL 地址的文件可下载时,它始终会下载。