码迷,mamicode.com
首页 > 其他好文 > 详细

Third-party Modules Using Note

时间:2015-09-17 18:58:19      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!