Re: ... remove all 0 values

2009-07-09 Thread Daniel Austria
Thanks a lot for your advices,

i decided to use the filter() method to sort out the 0.
i can ´t use the sum() function cause i need the list afterwards 


best,
Dan
-- 
http://mail.python.org/mailman/listinfo/python-list


[0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Daniel Austria
Hi python - hackers,

just one question. How can i remove all 0 values in a list? Sure - i
can loop over it, but that s not a neat style.  list.remove() will
only remove the first occurence. Doing that while no exception is
raised is also uncool, right?

Some suggestions?


Best,
Dan
-- 
http://mail.python.org/mailman/listinfo/python-list


10, 20, 30 to [10, 20, 30]

2006-11-23 Thread Daniel Austria
Sorry,

how can i convert a string like 10, 20, 30 to a list [10, 20, 30]

what i can do is:

s = 10, 20, 30
tmp = '[' + s + ']'
l = eval(tmp)

but in my opinion this is not a nice solution


daniel

-- 
http://mail.python.org/mailman/listinfo/python-list