re.match(pattern, string, flags) #Only beginning of the string
re.search(pattern, string, flags) #Searches everywhere of the string
import re string = ‘python crash course‘ m = re.match(‘y‘, string) print("Matching result: ", m) s = re.search(‘y‘, string) print("Searching result: ", s)
原文:https://www.cnblogs.com/dennisD/p/12402338.html