[Tutor] following the chain

Alan Gauld alan.gauld at freenet.co.uk
Tue May 10 21:32:48 CEST 2005


> import urllib
> name="some URL"
> X = urllib.urlopen(name)
> print X
>
> the output of X in very strange to me. I have include the exact
output:
>   <addinfourl at 585200 whose fp = <socket._fileobject object at
> 0x91068>>

The message is the clue. urlopen returms a fileobject. So you
treat X like an open file. You have to read() from it to get
the data.

Alan G.



More information about the Tutor mailing list