|
|
发表于 2017-7-25 16:04:54
|
显示全部楼层
os.walk(top, topdown=True, onerror=None, followlinks=False)
topdown = True,就会自动生成一个排序的目录吧,下边是从从help(os.walk)里复制出来的一段:
When topdown is true, the caller can modify the dirnames list in-place
(e.g., via del or slice assignment), and walk will only recurse into the
subdirectories whose names remain in dirnames; this can be used to prune the
search, or to impose a specific order of visiting. Modifying dirnames when
topdown is false is ineffective, since the directories in dirnames have
already been generated by the time dirnames itself is generated. No matter
the value of topdown, the list of subdirectories is retrieved before the
tuples for the directory and its subdirectories are generated.
我试了在excel “第1行”是排在“第11行”后边的,因为按第3个字符排序,‘行’对应‘1’ |
评分
-
查看全部评分
|