[Python] python查找目录下指定扩展名的文件 →→→→→进入此内容的聊天室

来自 , 2021-05-03, 写在 Python, 查看 195 次.
URL http://www.code666.cn/view/f84d4651
  1. import os
  2. items = os.listdir(".")
  3.  
  4. newlist = []
  5. for names in items:
  6.     if names.endswith(".txt"):
  7.         newlist.append(names)
  8. print newlist

回复 "python查找目录下指定扩展名的文件"

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

captcha