On Apr 3, 1:49 pm, [EMAIL PROTECTED] wrote:
> On Apr 3, 1:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote:
>
> > It depends on your application, but a 'set' might really be what you
> > want, as opposed to a list.
>
> > >>> s = set(["0024","haha","0024"])
> > >>> s
>
> > set(["0024","haha"])>>> s.remove("0024")
> > >>> s
>
> > set(["haha"])
>
> If you want, you can also loop over the list, like so:
>
> counter = 0
> your_list = ["0024","haha","0024"]
> for i in your_list:
>         if i == '0024':
>                 your_list.pop(counter)
>         counter += 1
>
> Mike

If you want to get really fancy, you could do a list comprehension
too:

your_list = ["0024","haha","0024"]
new_list = [i for i in your_list if i != '0024']

Mike

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

Reply via email to