Re: file i/o api for URL
Guido.van.Rossum@cwi.nl
Errors-To: listmaster@www0.cern.ch
Date: Fri, 13 May 1994 01:11:46 +0200
Errors-To: listmaster@www0.cern.ch
Message-id: <9405122308.AA21613=guido@voorn.cwi.nl>
Errors-To: listmaster@www0.cern.ch
Reply-To: Guido.van.Rossum@cwi.nl
Originator: www-talk@info.cern.ch
Sender: www-talk@www0.cern.ch
Precedence: bulk
From: Guido.van.Rossum@cwi.nl
To: Multiple recipients of list <www-talk@www0.cern.ch>
Subject: Re: file i/o api for URL
X-Listprocessor-Version: 6.0c -- ListProcessor by Anastasios Kotsikonas
> I need a file i/o api (you know: open, close, read, seek, ...) for
> URLs. This would give me a simple way to let any application access
> local or remote files. Does anybody have this kind of code already
> or have a suggestion other than hacking it out of the www lib?
If you're willing to write your application in Python, the module
"urllib" would do what you want. Using it, you can do things like
>>> f = urllib.urlopen('http://www.cwi.nl/')
>>> while 1:
... line = f.readline()
... if not line: break # EOF
... print line,
...
(contents of requested url appears here)
>>>
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>