[Python] python列出指定目录下的文件和子目录 →→→→→进入此内容的聊天室

来自 , 2021-02-12, 写在 Python, 查看 114 次.
URL http://www.code666.cn/view/12780ea6
  1. # if you know the exact name:  
  2. import os  
  3. files = os.listdir('/path/to/dir/')  
  4.  
  5. # if you want shell-style globbing:  
  6. import glob  
  7. files = glob.glob('/path/to/dir/*.html')

回复 "python列出指定目录下的文件和子目录"

这儿你可以回复上面这条便签

captcha