Import Urllib.request
Import OS
#Download resources to LocalUrlUrlPathLocal Path
def downloadpic (Url,path):
If not os.path.exists (path):#Determine if a folder exists locally
Os.makedirs (PATH)
path=path+"1.jpeg"
Urllib.request.urlretrieve (URL, path)
#Download stock information to a localCsvFormat
def downloadstock (Url,path):
If not os.path.exists (path):#Determine if a folder exists locally
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)
Python Downloads resources to local