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

来自 , 2021-04-07, 写在 Python, 查看 153 次.
URL http://www.code666.cn/view/fea33a31
  1. #!/usr/bin/python
  2.  
  3. # Use the standard find method to look for GIF files.
  4. import sys, find
  5.  
  6. if len(sys.argv) > 1:
  7.     dirs = sys.argv[1:]
  8. else:
  9.     dirs = [ '.' ]
  10.  
  11. # Go for it.
  12. for dir in dirs:
  13.     files = find.find('*.gif', dir)
  14.     if files:
  15.         print "For", dir + ':'
  16.         for fn in files:
  17.             print " ", fn
  18.     else:
  19.         print "For", dir + ': None'
  20.  
  21. #//python/8022

回复 "python在指定的目录下查找gif文件"

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

captcha