urllib should support iterator interface
Iwan van der Kleyn
null at null.com
Sat May 17 08:20:54 EDT 2003
Neal D. Becker wrote:
> Subject says it all. To be more consistent with file interface,
> urllib.open() should return an object that is iterable.
>
>>> from urllib import *
>>> for l in urlopen('http://www.python.org'):
... print l,
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?xml-stylesheet href="./css/ht2html.css" type="text/css"?>
<html>
<!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->
<!-- Tue May 13 19:08:32 2003 -->
.......<Rest of output deleted>............
From Python 2.3 on it does
More information about the Python-list
mailing list