|
|
发表于 2016-9-24 21:29:32
|
显示全部楼层
见小甲鱼的帖子:http://bbs.fishc.com/forum.php?m ... peid%26typeid%3D403
walk(top) 遍历top路径以下所有的子目录,返回一个三元组:(路径, [包含目录], [包含文件])
以我的计算机为例,其中的第一个i值是
('D:\\python35', ['DLLs', 'Doc', 'include', 'Lib', 'libs', 'Scripts', 'share', 'tcl', 'Tools', '__pycache__'], ['1.txt', '2.txt', 'hello.py', 'LICENSE.txt', 'LICENSE1', 'NEWS.txt', 'pp-wininst.log', 'python.exe', 'python.pdb', 'python3.dll', 'python35.dll', 'python35.pdb', 'python35_d.dll', 'python35_d.pdb', 'python3_d.dll', 'pythonw.exe', 'pythonw.pdb', 'pythonw_d.exe', 'pythonw_d.pdb', 'python_d.exe', 'python_d.pdb', 'README.txt', 'Removepp.exe', 't.png', 'vcruntime140.dll'])
i[0] = 'D:\\python35
i[1] = ['DLLs', 'Doc', 'include', 'Lib', 'libs', 'Scripts', 'share', 'tcl', 'Tools', '__pycache__']
i[2] = ['1.txt', '2.txt', 'hello.py', 'LICENSE.txt', 'LICENSE1', 'NEWS.txt', 'pp-wininst.log', 'python.exe', 'python.pdb', 'python3.dll', 'python35.dll', 'python35.pdb', 'python35_d.dll', 'python35_d.pdb', 'python3_d.dll', 'pythonw.exe', 'pythonw.pdb', 'pythonw_d.exe', 'pythonw_d.pdb', 'python_d.exe', 'python_d.pdb', 'README.txt', 'Removepp.exe', 't.png', 'vcruntime140.dll'] |
|