#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Introduce : 下载文件
@File : download.py
@Time : 2021-06-06 17:35
@Author : xia hua dong
@Tel : 173 179 76823
@Email : 17317976823@163.com
@pip : pip install
"""
# 引用 requests文件
import requests
def load_with_url(input_url, output_file):
"""
下载文件
:param input_url: 下载网址
:param output_file: 本地文件路径
:return:
"""
f = requests.get(input_url)
# 下载文件
with open(output_file, "wb") as file:
file.write(f.content)
if __name__ == '__main__':
input_url = 'http://quotes.money.163.com/service/lrb_600519.html'
output_file = "123.csv"
load_with_url(input_url, output_file)
python 通过路径下载文件
最新推荐文章于 2024-08-10 16:17:02 发布