python在指定目录下查找gif文件的方法
更新时间:2015年05月04日 12:31:15 作者:重负在身
这篇文章主要介绍了python在指定目录下查找gif文件的方法,涉及Python操作文件的相关技巧,非常具有实用价值,需要的朋友可以参考下
本文实例讲述了python在指定目录下查找gif文件的方法。分享给大家供大家参考。具体实现方法如下:
#!/usr/bin/python
# Use the standard find method to look for GIF files.
import sys, find
if len(sys.argv) > 1:
dirs = sys.argv[1:]
else:
dirs = [ '.' ]
# Go for it.
for dir in dirs:
files = find.find('*.gif', dir)
if files:
print "For", dir + ':'
for fn in files:
print " ", fn
else:
print "For", dir + ': None'
希望本文所述对大家的Python程序设计有所帮助。
相关文章
selenium使用chrome浏览器测试(附chromedriver与chrome的对应关系表)
这篇文章主要介绍了selenium使用chrome浏览器测试(附chromedriver与chrome的对应关系表),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-11-11


最新评论