mjteigen wrote: > My goal is print out '<img src="5.jpg">'. However, when I view the > source on the generated html page, I see this: > > <img src= 5 .jpg> > > In other words, that "5" has a space tacked on either side of it, and > of course a browser can't find the file. Is there a way I can avoid the > tacking of spaces on either side of a variable inserted between two > strings?
Yes, use placeholders. In your example, print "<img src=\"%d.jpg\">" % (number,) http://www.python.org/dev/doc/devel/lib/typesseq-strings.html http://diveintopython.org/native_data_types/formatting_strings.html -- http://mail.python.org/mailman/listinfo/python-list