Seek in urllib.urlopen()?
Robert Roy
rjroy at takingcontrol.com
Tue Jun 6 22:04:03 EDT 2000
On Tue, 06 Jun 2000 07:32:22 GMT, thomas at cintra.no (Thomas Weholt)
wrote:
>Hi,
>
>I was wondering if you could use some method similar to seek in the
>urllib-module. If I want to read just the 256 bytes in the middle of a
>file, not read the entire crap in front of those bytes, can I do that,
>or do I have to read all the data in front too?
>
>Thomas
>From the documentation for urllib.urlopen(
This supports the following methods: read(), readline(), readlines(),
fileno(), close(), info() and geturl().
so no seek()...
nothing preventing you from doing
x = urlopen('http://www.python.org')
# read into the file and throw away result
x.read(1024)
stuffIWant = x.read(256)
Bob
More information about the Python-list
mailing list