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 BeautifulSoupimport 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
时间: 2024-10-11 03:33:12