0

I want to fetch a webpage, but the data I need is in the first fifteen characters. How can I only fetch part of the page, as opposed to the entire page, with urllib?

4

1 回答 1

0

You can mention the number of bytes to read like this:

data = urllib.urlopen("www.example.com")
number_of_bytes_to_read = 15
content = data.read(number_of_bytes_to_read)
于 2012-04-15T19:56:34.643 回答