python从字符串内取两个符号之间的内容

  #取字符串中两个符号之间的东东
     def txt_wrap_by(self,start_str, end, html):
        start = html.find(start_str)
        if start >= 0:
            start += len(start_str)
            end = html.find(end, start)
            if end >= 0:
                return html[start:end].strip()


#调用
 newsDate=self.txt_wrap_by("[","]",liCon)

  

posted @ 2015-06-19 16:24  小马的酒吧  阅读(21043)  评论(0编辑  收藏  举报