标签: python directory
使用Python,我如何只获取当前文件夹及其子文件夹的名称?
答案 0 :(得分:5)
import os for root, dirs, files in os.walk(".", topdown=False): for name in files: print(os.path.join(root, name)) for name in dirs: print(os.path.join(root, name))