小脚本很简单,主要是练习一下正则匹配,与简单的urllib库的应用
#coding: utf8
import urllib,re
import os
def getLastinstall():
page = urllib.urlopen(r'http://sd.360.cn/download_center.html')
html = page.read()
page.close()
rematch = r'http://down.360.cn/360sd/360sd_se_(.*?)exe'
replusmatch = r'http://down.360.cn/360sd/360sd_plus_(.*?)exe'
stdname = '360sd_'+(str(re.compile(rematch).findall(html)[0]))+'exe'
downurlstd = r'http://down.360.cn/360sd/360sd_'+(str(re.compile(rematch).findall(html)[0]))+'exe'
powname = '360sd_plus_'+(str(re.compile(replusmatch).findall(html)[0]))+'exe'
downurlpow = r'http://down.360.cn/360sd/360sd_plus_'+(str(re.compile(replusmatch).findall(html)[0]))+'exe'
localpath