Questions: While And List Comprehension

rantingrick rantingrick at gmail.com
Thu Nov 11 00:05:41 EST 2010


On Nov 10, 4:56 pm, Emile van Sebille <em... at fenx.com> wrote:
> On 11/10/2010 4:36 AM Felipe Vinturini said...
>
> > Hi Folks,
>
> > I am quite new to python and I don't have a lot of experience with it yet.
>
> > I have two simple questions:
>
> > 1. Is there a way to limit the number of times a list comprehension will
> > execute? E.g. I want to read from input only 5 values, so I would like
> > something like (the values between # # are what I want):


Hey all you guys could be mistaken. It looks like the OP is trying to
implement some sort of ghetto database. And he may NOT necessarily
want the FIRST five lines of the file. He said (and i quote) "the
values /between/ # and #". Where # and # are starting and ending of a
range -- not necessarily the starting of the input file! However we
really need the OP to clear up these questions!



More information about the Python-list mailing list