| Store | Cart

Get document as normal text and not as binary data

From: Markus Franz <mf1...@arcor.de>
27 Mar 2005 03:42:19 -0800
Hi.

I used urllib2 to load a html-document through http. But my problem
is:
The loaded contents are returned as binary data, that means that every
character is displayed like l???t, for example. How can I get the
contents as normal text?

My script was:

import urllib2
req = urllib2.Request(url)
f = urllib2.urlopen(req)
contents = f.read()
print contents
f.close()

Thanks!

Markus

Recent Messages in this Thread
Markus Franz Mar 27, 2005 11:42 am
Diez B. Roggisch Mar 27, 2005 11:51 am
Markus Franz Mar 28, 2005 03:48 pm
Diez B. Roggisch Mar 28, 2005 06:26 pm
Diez B. Roggisch Mar 28, 2005 06:29 pm
Markus Franz Mar 29, 2005 06:15 pm
Fredrik Lundh Mar 27, 2005 12:35 pm
Kent Johnson Mar 28, 2005 07:37 pm
Markus Franz Mar 29, 2005 06:13 pm
Messages in this thread