如何在python中进行条件循环,同时跳过一些文件并顺序读取?

问题描述

#我想循环播放,因为在我的图像文件夹中有数千个图像(图像名称类似于t000001xy1c1.tif,t000001xy1c2.tif,t000001xy1c3.tif)。我该如何操作以下脚本来制作内容,以便可以从列表中依次跳过每第二张图像。##

##generating gzip file (black images),##keeping it in the same directory and deleting the raw file##

import gzip
import os


#input file name

in_file = "t000001xy1c4.tif"

#reading input file

in_data = open(in_file,"rb").read()

#output file format (making gzip file and deleting the in_file)

out_gz = "t000001xy1c4.tif.gz"

gzf = gzip.open(out_gz,"wb")

gzf.write(in_data)

gzf.close()

#delete the original file after the gzip is done##

os.unlink(in_file)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)