def list_allfile(path, all_files=[], all_py_files=[]):
if os.path.exists(path):
files = os.listdir(path)
else:
print('this path not exist')
for file in files:
if os.path.isdir(os.path.join(path, file)):
list_allfile(os.path.join(path, file), all_files)
else:
all_files.append(os.path.join(path, file))
for file in all_files:
if file.endswith('.js'):
all_py_files.append(file)
return all_py_files
if __name__ == "__main__":
js_list = list_allfile(r"~/下载/dist/static/js")
print(js_list)