newbie problem with urllib.urlopen
Wendelin Auer
wa at net-federation.de
Tue May 22 11:21:50 EDT 2001
Hello,
I'm no python programmer, but I have to fix a python problem in a search
engine.
I want to fetch two urls and write the content in the header and footer part
of a html-file.
It nearly works, but theres one problem left. Don't worry about the strange
output mode, this is a part of one of many html-templates with scripted
python:
..........
<!--$
import urllib
f = urllib.urlopen("http://www.url.de/test/footer.txt")
data = f.read()
f.close()
-->
&$data;
.............
I hope this is not ridicolous ;-)
My Problem: This returns something like:
<td nowrap bgcolor="#e5edf0"><img
src="images/pix.gif" width="1"
height="1"></td>
</tr>
</table>
</body>
</html>
This is what was fetched:
<td nowrap bgcolor="#e5edf0">
<img src="images/pix.gif" width="1" height="1">
</td>
</tr>
</table>
</body>
</html>
All linebreaks are gone, too.
What I need is a way to decode, or even better, to get exactly the content
of the fetched url into the data-variable.
Please do not only explain, an example would be nice, i'm an absolute
beginner.
Thanks in advance,
Wendelin Auer
More information about the Python-list
mailing list