回復 4# hhy
我是想直接改之前綠茶妹的程式,但我不確定asp的網頁是否指定參數,
就可直接到指定參數的網頁。
http://coco-in.net/viewthread.php?tid=4082&extra=page%3D1%26amp%3Bfilter%3Dtype%26amp%3Btypeid%3D21
- from urllib import urlretrieve
- from datetime import date
- from datetime import datetime, timedelta
- #today = date.today().strftime('%Y_%m_%d')
- today = datetime.today()
- yesterday=today
- for daynum in range(1, 61):
- path = yesterday.strftime('%Y_%m_%d')
- name = 'Daily_'+path+'.zip'
- print name
- try:
- urlretrieve('http://www.taifex.com.tw/DailyDownload/'+name, 'C:\\test\\'+name)
- except IOError as IOE :
- print 'fault'
- except ContentTooShortError('!!',50) as CE:
- print 'too short'
- yesterday = yesterday - timedelta(1)
|