码迷,mamicode.com
首页 > 其他好文 > 详细

glob

时间:2020-03-31 22:45:41      阅读:57      评论:0      收藏:0      [点我收藏+]

标签:name   code   div   col   class   目录   glob   txt   sub   

一、glob

import glob
for name in glob.glob(dir/*):#遍历该目录下所有子文件的名字
    print (name)
dir/file.txt
dir/file1.txt
dir/file2.txt
dir/filea.txt
dir/fileb.txt
dir/subdir

 

glob

标签:name   code   div   col   class   目录   glob   txt   sub   

原文地址:https://www.cnblogs.com/liuxiangyan/p/12609050.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!