获取文件夹下所有文件名.py

import os
import time


filePath = 'C:/--------老男孩全栈--------/'
for i,j,k in os.walk(filePath):
#print(i)
#print(j)
#print(k)
for bb in k:
time.sleep(0.01)
#with open("test.txt", "w") as f:
#f.writelines(bb)
#print(bb)
f = open('test.txt','a+')
f.writelines(bb)
f.writelines('\n')
f.close()
print(bb)
posted @ 2020-07-01 16:58  juham  阅读(104)  评论(0编辑  收藏  举报