#!/usr/bin/python
import os
arrdir=os.listdir(os.getcwd())
displaypath="/home"
f=file("index.html","w+")
f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)
f.write('<head>\n<link rel="stylesheet" type="text/css" href="http://www.5ichai.com/stylesheets/stylesheet.css" media="screen">\n</head>')
f.write("<body>\n")
f.write('<div class="container">')
f.write("<h2>Directory listing for %s</h2>\n" % displaypath)
f.write("<hr>\n<ul>\n")
arrdir.sort()
for i in arrdir:
filename,ext= os.path.splitext(i)
if (not cmp(ext,'.jpg')):
i1=i[9:11]
print i,i1
f.write('<img src="%s" alt="%s" width="160" height="160">\n'%(i,i1))
f.write("</ul>\n<hr>\n")
f.write("</div>")
f.write("</body>\n</html>\n")
f.close