how to display an HTML <img scr> tag using Python...

Peter Hansen peter at engcorp.com
Wed Feb 12 08:58:55 EST 2003


Jay wrote:
> 
> using
> 
> print '<html tags here>'
> 
> you can use html tags that can be displayed on screen.  But when using
> print '<img src"file.jpg">'

Correction: you are missing an equal sign after the attribute name.

 print '<img src="file.jpg">'

Now the key question is this: where is file.jpg?  I suspect it needs 
to be in the same place as the script is, but that might not be 
allowed by the server configuration.  Therefore you might want to
point to it in a different way.  I'd suggest experimenting with
the location of the file and trying multiple links like "../file.jpg"
and "../images/file.jpg" and "/file.jpg" and "/~youruserid/file.jpg"
or whatever until you get it right.

> Sorry about being too ambigous, I'm new at this groups thing..

More information is always better when you're new.  Just picture
what information we don't have and try to fill us in.  What's
the name of the script, how are you referencing it from the original
HTML file, what directory structure do you have, etc... not
that all or any of these specific questions are necessarily useful
in this case.

Also try always to show the *exact* code you are trying to run
(though perhaps not all of it... don't post more than twenty lines
if fewer is enough to get the point across).  Otherwise we are
stuck trying to interpret stuff that might not actually have the 
problem because you mistyped it.  For example, did you really
leave out the "=" in the original, or was it just a typo here?

-Peter




More information about the Python-list mailing list