摘要: 开始学Python,这篇文章来自于应用需求。 os.walk很方便,下面写了两个版本的函数进行遍历,分别是不使用walk和使用walk的。import sysimport stringimport osdef detect_nowalk(dir_path): files = os.listdir(dir_path) for filename in files: print "file:%s\n" % filename next = os.path.join(dir_path, filename) if os.path.isdir(ne... 阅读全文
posted @ 2013-01-11 19:52 五岳 阅读(11435) 评论(3) 推荐(0) 编辑
回到顶部