注:部分内容来自书籍或者网络,如有侵权,请联系删除。
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import os
def find_file(keywords,path):
file_list = get_all_file(path)
for file in file_list:
if file.endswith('.php'):
with open(file,'r',encoding='utf-8') as f:
if keywords in f.read():
print(file)
print('=='*20)
def get_all_file(path):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
yield os.path.join(dirpath,filename)
keywords = input("Please input the key words that you want to search:")
path = input("Please input the filepath:")
find_file(keywords,path)
「 文章如果对你有帮助,请点个赞哦^^ 」 
0
若无特殊注明,文章均为本站原创或整理发布。
转载请注明本文地址:https://om.fangxiaoxiong.com/2767.html