This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bs4 import BeautifulSoup | |
from urllib.parse import urljoin, urlparse | |
def ensure_dir(file_path): | |
"""确保文件路径中的目录存在""" | |
directory = os.path.dirname(file_path) | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
def download_resource(resource_url, base_folder): |