Home

On Tue, 18 Sep 2007 13:59:47 -0700, koutoo wrote:

> I am working on a loop for my code and was wondering if there is a way
> to limit the number of lines read through? I'd hate to cut the test
> file in order to run the code in the testing phase. Can you add a
> value in the parenthesis of the readline() function?
>
> t = string.readline() # Limit this somehow?

Do you want to limit how much of *one* line is read or the number of lines!?

The latter can be done with `itertools.islice()`.

Ciao,
Marc 'BlackJack' Rintsch

previous
next

Re: placement new
Re: Important Research Project
Re: Does shuffle() produce uniform result ?
Re: Submit web form only client-side with Python? COM?
Release file descriptor in c/c++
Fundacja Iskierka
Fundacja Avalon
Dzieci Niczyje
Mimo Wszystko
Fundacja Sloneczko