Shashwat Anand wrote:
<snip>
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)
I see a small typo here.
print "<a href=\"%s/%s\"><img src=\"%s\%s\" /></a>"
%(currentdir,filename,currentdir,filename) should rather be print "<a
href=\"%s/%s\"><img src=\"%s/%s\" /></a>"
%(currentdir,filename,currentdir,filename) ..
notice the slashes "%s/%s" in href tag and "%s\%s" in img tag.
>>> filename = '1.jpg'
>>> absolutePath = os.getcwd()
>>> currentdir = os.path.basename(absolutePath)
>>> print "<a href=\"%s/%s\"><img src=\"%s/%s\" /></a>"
%(currentdir,filename,currentdir,filename)
<a href="Desktop/1.jpg"><img src="Desktop/1.jpg" /></a>
~l0nwlf
Arrrgh. Didn't see that forwardslash I put in there. It's fixed and
works now.
Thanks!
Dayo
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor