Clearing an array
Diez B. Roggisch
deets at nospam.web.de
Wed Jul 29 11:32:36 EDT 2009
WilsonOfCanada wrote:
> Hellos,
>
> I was wondering if there is any built-in function that clears the
> array. I was also wondering if this works:
>
> arrMoo = ['33', '342', .... '342']
> arrMoo = []
Most of the time, yes. Unless you have something like this, then it won't
work:
foo = [10]
bar = foo # an alias
foo = []
assert foo == bar
Then what you need to to is this:
foo[:] = []
Diez
More information about the Python-list
mailing list