En Tue, 15 Apr 2008 20:26:16 -0300, Yves Dorfsman <[EMAIL PROTECTED]>
escribió:
> Dan Bishop wrote:
>
lines[:] = [line.rstrip('\n') for line in lines]
>>> What is the point of the [:] after lines ? How different is it with or
>>> without it ?
>>
>> It causes the result to be stored in the e
On Apr 16, 9:26 am, Yves Dorfsman <[EMAIL PROTECTED]> wrote:
> If we do:
> lines[:] = [line.rstrip('\n') for line in lines]
>
> We reuse an existing list, therefore we are saving the time it takes to
> create a new list ? So this is a performance issue ?
I think it's more of a reference issue. You
Dan Bishop wrote:
>>> lines[:] = [line.rstrip('\n') for line in lines]
>> What is the point of the [:] after lines ? How different is it with or
>> without it ?
>
> It causes the result to be stored in the existing list.
>
If we do:
lines = [line.rstrip('\n') for line in lines]
lines is now a
On Apr 14, 10:55 pm, Yves Dorfsman <[EMAIL PROTECTED]> wrote:
> Gabriel Genellina wrote:
> > En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
> >> l=['5\n', '2\n', '7\n', '3\n', '6\n']
>
> >> how to remove \n from the given list
>
> > l is is very poor name... I'll use lines instead:
>
> > lines[:
Gabriel Genellina wrote:
> En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
>> l=['5\n', '2\n', '7\n', '3\n', '6\n']
>>
>> how to remove \n from the given list
>
> l is is very poor name... I'll use lines instead:
>
> lines[:] = [line.rstrip('\n') for line in lines]
When I saw the original me
On Apr 14, 2:58 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
> <[EMAIL PROTECTED]> escribió:
>
> > hi,
> > l=['5\n', '2\n', '7\n', '3\n', '6\n']
>
> > how to remove \n from the given list
>
> l is is very poor name... I'll use lines instead:
En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
<[EMAIL PROTECTED]> escribió:
> hi,
> l=['5\n', '2\n', '7\n', '3\n', '6\n']
>
> how to remove \n from the given list
l is is very poor name... I'll use lines instead:
lines[:] = [line.rstrip('\n') for line in lines]
--
Gabriel Genellina
--