标签:dstat exists 文件 close pre python color hdd html
import urllib.request
import os
#下载资源到本地 url 网址 path 本地路径
def downLoadPic(url,path):
if not os.path.exists(path):#判断本地是否存在文件夹
os.makedirs(path)
path=path+"1.jpeg"
urllib.request.urlretrieve(url, path)
#下载股票信息到本地的csv格式
def downLoadStock(url,path):
if not os.path.exists(path):#判断本地是否存在文件夹
os.makedirs(path)
path=path+"2.csv"
urllib.request.urlretrieve(url, path)
url1="https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1510479255&di=b684cee336d69fba64629bf6cdec3083&src=http://img4q.duitang.com/uploads/item/201504/22/20150422H2151_V5QPN.jpeg"
path1="C:\\Users\\song\\Desktop\\download\\"
downLoadPic(url1,path1)
url2="http://quotes.money.163.com/service/chddata.html?code=1300133&end=20151023&fields=TCLOSE;HIGH;LOW;TOPEN;LCLOSE;CHG;PCHG;TURNOVER;VOTURNOVER;VATURNOVER;TCAP;MCAP"
path2="C:\\Users\\song\\Desktop\\download\\"
downLoadStock(url2,path2)
标签:dstat exists 文件 close pre python color hdd html
原文地址:http://www.cnblogs.com/888ewe/p/7822375.html