# -*- coding:utf-8 -*- #author:V def tol (file1,gui): #写一个方法,定义文件,or 匹配规则 import re patt = re.compile(gui) #print(type(patt)) f = open(file1,'r') #print(type(f)) try: return len(patt.findall(f.read())) #findall接受str类型,之前我把file 类型房间去,结果傻逼了 finally: #不…