赞
踩
urlretrieve(url, filename)函数
url 代表的是下载的路径 filename文件的名字
下载网页:
url_page = "http://www.baidu.com"
urllib.request.urlretrieve(url_page, 'baidu.html')
下载图片:
url_img = "https://img0.baidu.com/it/u=2751401762,3421611251&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666"
urllib.request.urlretrieve(url_img, 'oynn.jpg')
下载视频
url_video = "https://vd3.bdstatic.com/mda-mb0kga212eimq2rj/sc/cae_h264_nowatermark/1612162315/mda-mb0kga212eimq2rj.mp4?v_from_s=hkapp-haokan-suzhou&auth_key=1689146201-0-0-c3d051d494272a41133272417ea734ef&bcevod_channel=searchbox_feed&pd=1&cr=2&cd=0&pt=3&logid=2801603871&vid=12701144788318982457&abtest=110930_1&klogid=2801603871"
urllib.request.urlretrieve(url_video, 'video.mp4')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。