sys.stdin.readline()

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Thu Sep 2 13:29:25 EDT 2004


I just realized...

Mike Maxwell wrote:
> When I invoke readline() in a for loop, why does it return a series of
> one-char strings, rather than the full line?
> 
>>>> for sL in sys.stdin.readline(): print sL

for sL in iter(sys.stdin.readline, ''): print sL,

-- 
Hallvard



More information about the Python-list mailing list