Re: how to remove \n in the list

2008-04-15 Thread Gabriel Genellina
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

Re: how to remove \n in the list

2008-04-15 Thread alex23
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

Re: how to remove \n in the list

2008-04-15 Thread Yves Dorfsman
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

Re: how to remove \n in the list

2008-04-14 Thread Dan Bishop
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[:

Re: how to remove \n in the list

2008-04-14 Thread Yves Dorfsman
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

答复: 答复: how to remove \n in the list

2008-04-14 Thread Penny Y.
that's right. got it thanks. -邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Eric Brunel 发送时间: 2008年4月14日 16:17 收件人: python-list@python.org 主题: Re: 答复: how to remove \n in the list (please avoid top-posting... corrected) On Mon, 14 Apr 2008 09:08:06 +0200, Penny Y. &l

Re: 答复: how to remove \n in the list

2008-04-14 Thread Eric Brunel
(please avoid top-posting... corrected) On Mon, 14 Apr 2008 09:08:06 +0200, Penny Y. <[EMAIL PROTECTED]> wrote: > -邮件原件- > 发件人: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] 代表 Gabriel > Genellina > 发送时间: 2008年4月14日 12:59 > 收件人: python-list@python.org > 主题: Re: h

Re: 答复: how to remove \n in the list

2008-04-14 Thread Gabriel Genellina
En Mon, 14 Apr 2008 04:08:06 -0300, Penny Y. <[EMAIL PROTECTED]> escribió: >> lines[:] = [line.rstrip('\n') for line in lines] > > why not just: > > lines = [line.rstrip('\n') for line in lines] > > > what's the difference between lines[:] and lines here? Thanks. My version (using [:]) replaces t

答复: how to remove \n in the list

2008-04-14 Thread Penny Y.
2008年4月14日 12:59 收件人: python-list@python.org 主题: Re: how to remove \n in the list 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

Re: how to remove \n in the list

2008-04-13 Thread Kam-Hung Soh
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:

Re: how to remove \n in the list

2008-04-13 Thread Gabriel Genellina
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 --

how to remove \n in the list

2008-04-13 Thread reetesh nigam
hi, l=['5\n', '2\n', '7\n', '3\n', '6\n'] how to remove \n from the given list -- http://mail.python.org/mailman/listinfo/python-list