Python Python 正则 取中括号值

str = '[111]dsfdsd[33333]'

pattern = r"(\[.*?\])";
                    guid = re.findall(pattern,str ,re.M)
                    if(len(guid)>0):
                        guid = guid[0]
                        guid = guid.replace('[','').replace(']','')

posted @ 2012-05-17 09:58  小さいです哥  阅读(8053)  评论(0编辑  收藏  举报