P
Penny Y.
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.
-----ÓʼþÔ¼þ-----
·¢¼þÈË: [email protected]
[mailto
[email protected]] ´ú±í Gabriel
Genellina
·¢ËÍʱ¼ä: 2008Äê4ÔÂ14ÈÕ 12:59
ÊÕ¼þÈË: (e-mail address removed)
Ö÷Ìâ: Re: how to remove \n in the list
En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
l is is very poor name... I'll use lines instead:
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.
-----ÓʼþÔ¼þ-----
·¢¼þÈË: [email protected]
[mailto
Genellina
·¢ËÍʱ¼ä: 2008Äê4ÔÂ14ÈÕ 12:59
ÊÕ¼þÈË: (e-mail address removed)
Ö÷Ìâ: Re: how to remove \n in the list
En Mon, 14 Apr 2008 01:41:55 -0300, reetesh nigam
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]