[Python-Dev] teaching the new urllib
Benjamin Peterson
benjamin at python.org
Tue Feb 3 21:01:02 CET 2009
On Tue, Feb 3, 2009 at 2:08 PM, Brad Miller <millbr02 at luther.edu> wrote:
> Here's the iteration problem:
> 'b\'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\\n\''
>>>> for line in page:
> print(line)
> Traceback (most recent call last):
> File "<pyshell#10>", line 1, in <module>
> for line in page:
> TypeError: 'addinfourl' object is not iterable
> Why is this not iterable anymore? Is this too a bug? What the heck is an
> addinfourl object?
See http://bugs.python.org/issue4608.
>
> 5. Finally, I see that a bytes object has some of the same methods as
> strings. But the error messages are confusing.
>>>> line
> b' "http://www.w3.org/TR/html4/loose.dtd">\n'
>>>> line.find('www')
> Traceback (most recent call last):
> File "<pyshell#18>", line 1, in <module>
> line.find('www')
> TypeError: expected an object with the buffer interface
>>>> line.find(b'www')
> 11
> Why couldn't find take string as a parameter?
See http://bugs.python.org/issue4733
--
Regards,
Benjamin
More information about the Python-Dev
mailing list