[...]

> I have been using something like this:
> _____________________
> 
> while list[0] != O:
>     storage.append(list[0])
>     list.pop(0)
>     if len(list) == 0:
>         break
> _____________________
> 
> But this seems ugly to me, and using "while" give me the heebies.  Is
> there a better approach?

 >>> lst = [1,2,3,4,5,0,0,0,0]
 >>> del lst[lst.index(0):]
 >>> lst
[1, 2, 3, 4, 5]
 >>>

Regards, Daniel

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

Reply via email to