python的正则表达式
1.re.findall("a","ab") a:匹配规则 ab:要匹配的内容 结果以列表的形式返回:['a'] 2.元字符:".","^","$","*","+","?","{ }","[ ]","|","( )","\" ".":匹配除换行符“\n”以外任何字符; import re A = re.findall('ab.d',"abcdefg") B = re.findall('ab.e',"abcdefg") print(A) #['abcd'] print(B) #[] "^":匹配字符串开头 import re A = re.findall('^ab',"abcdefg") B = re.findall('^bc',"abcdefg") print(A) #['ab'] print(B) #[] "$":匹配字符串结尾 import re A = re.findall('ab$',"abcdefg") B = re.findall('fg$',"abcdefg") print(A) #[] print(B) #['fg'] "*":匹配前一个字符0次或无限次 import re A = re.findall('ab*',"abbdefg") B = re.findall('ab*',"acdefg") print(A) #['abb']