>> Question: how do I get rid of the \n attached to each member in my  
>> list?
>
> Choose:
>
> map(int(map(string.strip, yourlist)) (Python 2.2)
>
> [ int(x.strip()) for x in yourlist ] (Python 2.3)
>
> ( int(x.strip()) for x in yourlist ) (Python 2.4)
>

You don't need strip(), int() ignores white space. So the generator- 
expression version could be (others could be shortened similarly):

(int(x) for x in yourlist)

--Dethe

A miracle, even if it's a lousy miracle, is still a miracle.  --Teller


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to