Hi all,

This script I'm working on, should take all the image files in the current 
directory
and generate an HTML thumbnails.

import os
import urllib

# Generate thumbnail gallery
def genThumbs():
   # Get current directory name
   absolutePath = os.getcwd()
   urlprefix = "http://kili.org/~dayo";
   currentdir = os.path.basename(absolutePath)

   for dirname, subdirname, filenames in os.walk(absolutePath):
       for filename in filenames:
           print "<a href=\"%s/%s\"><img src=\"%s\%s\" /></a>" 
%(currentdir,filename,currentdir,filename)

# Generate thumbnail gallery
genThumbs()

However, this is the type of output I get:

<a href="http://kili.org/~dayo/thumbs/00838_drops_1024x768.jpg";><img 
src="http://kili.org/~dayo\thumbs\00838_drops_1024x768.jpg"; /></a>


See how in the url in the src attribute of the img tag the slashes after "~dayo"
are somehow turned into backslashes, instead of forwardslashes. How come?

Best regards

Dayo

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to