#!/usr/bin/env python import cgitb cgitb.enable() import glob png = glob.glob('mini/*.png') jpg = glob.glob('mini/*.jpg') images = list(filename[5:-4] for filename in (png + jpg)) p = len(images) / 5 first = images[:p] second = images[p:p*2] third = images[p*2:p*3] fourth = images[p*3:p*4] fifth = images[p*4:] print 'Content-Type: text/html; charset=utf-8' print print """\ Lluniau Amrywiol (Miscellaneous Images)

Lluniau Amrywiol

directory · source

""" for part in (first, second, third, fourth, fifth): print '' print """\
' for image in part: print '

[%s]
%s

' % (image, image, image) print '

Sean B. Palmer, inamidst.com
""" # EOF