This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 只可以遍历指定文件夹rootdir中的文件夹名和文件名 | |
# 无法遍历出其中包含的子文件夹中的内容 | |
import os | |
rootdir = './' # 需要遍历的文件夹,这里设定为当前文件夹 | |
list = os.listdir(rootdir) | |
for line in list: | |
filepath = os.path.join(rootdir, line) | |
if os.path.isdir(filepath): |