shortening_py2.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码
def onShorten(self, event):
        """
        Shortens a URL using the service specified.
        Then sets the text control to the new URL.
        """
        text = self.inputURLTxt.GetValue()
        textLength = len(text)

        if re.match("^https?://[^ ]+", text) and textLength > 20:
            pass
        else:
            wx.MessageBox("URL is already tiny!", "Error")
            return

        URL = self.URLCbo.GetValue()
        if URL == "is.gd":
            self.shortenWithIsGd(text)
        elif URL == "bit.ly":
            self.shortenWithBitly(text)
        elif URL == "tinyurl":
            self.shortenWithTinyURL(text)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号