The problem seems be solved with urllib.request.urlretrieve()
I think the binary information read() was giving had headers like
content-size - but not HTTP headers.
The first couple of bytes indicate how much content to read and after
reading that content, the next set of bytes indicate the next
On Jan 16, 1:54 am, "Anjanesh Lekshminarayanan"
wrote:
> Using Python 3.0
>
> res = urllib.request.urlopen(url)
> f = open('file.txt', 'wb') # Since res.read() returns bytes
> f.write(res.read())
>
> But newline and return feeds are stored as b14, 58a as text in the text file.
I can't imagine how
On Jan 15, 9:54 am, "Anjanesh Lekshminarayanan"
wrote:
> Using Python 3.0
>
> So how do I to convert res.read() to ascii on opening the file in
> ascii mode f = open('file.txt', 'w')?
>
I think this is what you are looking for:
res = urllib.request.urlopen(url)
f = open('file.txt', 'w')
f.write(
Using Python 3.0
res = urllib.request.urlopen(url)
f = open('file.txt', 'wb') # Since res.read() returns bytes
f.write(res.read())
But newline and return feeds are stored as b14, 58a as text in the text file.
So how do I to convert res.read() to ascii on opening the file in
ascii mode f = open('