君逸a410,西安隐形耳机,证大家园业主论坛
def find_file_by_pattern(pattern='.*', base=".", circle=true):
'''''查找给定文件夹下面所有 '''
re_file = re.compile(pattern)
if base == ".":
base = os.getcwd()
final_file_list = []
print base
cur_list = os.listdir(base)
for item in cur_list:
if item == ".svn":
continue
full_path = os.path.join(base, item)
if full_path.endswith(".doc") or \
full_path.endswith(".bmp") or \
full_path.endswith(".wpt") or \
full_path.endswith(".dot"):
continue
# print full_path
bfile = os.path.isfile(item)
if os.path.isfile(full_path):
if re_file.search(full_path):
final_file_list.append(full_path)
else:
final_file_list += find_file_by_pattern(pattern, full_path)
return final_file_list
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
python中def是做什么的
python使用def开始函数定义,紧接着是函数名,括号内部为函数的参数,内部为函数的 具体功能实现代码,如果想要函数有返回值, 在expressions中的逻...
[阅读全文]
-
-
-
-
-
-
网友评论