import os import re
def findfile(path, str): for x in os.listdir(path): if os.path.isfile(x): match = re.compile(str).match(str) if match: print(os.path.join(path, x)) else: findfile(os.path.join(path, x), str) findfile('.', 'py')
好强!
Sign in to make a reply
Kisionl
import os import re
def findfile(path, str): for x in os.listdir(path): if os.path.isfile(x): match = re.compile(str).match(str) if match: print(os.path.join(path, x)) else: findfile(os.path.join(path, x), str) findfile('.', 'py')