python正则匹配括号里面的内容
importre
string = 'abe(ac)ad)'p1 = re.compile(r'[(](.*?)[)]', re.S) #最小匹配p2 = re.compile(r'[(](.*)[)]', re.S) #贪婪匹配print(re.findall(p1, string))print(re.findall(p2, string))
importre
string = 'abe(ac)ad)'p1 = re.compile(r'[(](.*?)[)]', re.S) #最小匹配p2 = re.compile(r'[(](.*)[)]', re.S) #贪婪匹配print(re.findall(p1, string))print(re.findall(p2, string))