标签:
Module
from optparse import OptionParser def opt(): usage = "usage: %prog [options] arg" parser = OptionParser(usage=usage) entries = [ ["--bashrcDir", "bashrc_dir", "~", "PATH", "write bashrcDir to bashrc_dir"], ["--hostname", "hostname", "", "SPEC", "modify hostname"], ["--clientroot", "clientroot", "/", "PATH", "create client workspace in clientroot"] ] for (a, b, c, d, e) in entries: parser.add_option(a, dest=b, default=c, metavar=d, help=e) (options, args) = parser.parse_args() return options
import BeautifulSoup
import natsort response = urllib2.urlopen(url) content = response.read() soup = BeautifulSoup.BeautifulSoup(content) versions = [] lists = soup.findAll(‘a‘) for value in lists: versions.append(value.string) versions = natsort.natsorted(versions, reverse=True) newest_version = versions[0] # e.g. natsort-3.1.0.tar.gz
Third-party Modules Using Note
标签:
原文地址:http://www.cnblogs.com/irun/p/4816870.html