用IE edge 当图像浏览器的脚本

在网上下载了一个文件包:手绘光碟图,里面是包含了很多tif图形文件的很多个文件夹,现在希望:
1.把文件夹名作为title;
2.一次性读取这些文件夹内的图像写入一个html内;

脚本如下:
import os

currentpath = r'C:\Users\super.000\Desktop\手绘光碟图(ED2000.COM)'
s = ''
os.chdir(currentpath)
for floder in os.listdir(currentpath):
s += '

' + floder + '

'+ '
'
floderpath = os.path.join(currentpath,floder)
if os.path.isdir(floderpath):
for file in os.listdir(floderpath):
filepath = os.path.join(floderpath,file)
if os.path.splitext(filepath)[1] == '.tif':
s += r'

'%filepath
s += '
\n'
s += ''
with open('手绘.html','w') as f:
f.write(s)

运行完会在同目录下创建一个手绘.html文件,用IE edge 打开,普通的ie浏览器打不开tif文件!

你可能感兴趣的:(用IE edge 当图像浏览器的脚本)