大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
import os def gci(filepath): #遍历filepath下所有文件,包括子目录 files = os.listdir(filepath) for fi in files: fi_d = os.path.join(filepath,fi) if os.path.isdir(fi_d): gci(fi_d) else: print(os.path.join(filepath,fi_d)) with open('z.txt',mode='at',encoding='utf-8') as f: f.write(os.path.join(filepath,fi_d)+'\n')