Third-party Modules Using Note

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

 

posted @ 2015-09-17 16:50  irun  阅读(225)  评论(0编辑  收藏  举报