after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself?
SuperHik
junkytownMAKNI at gmail.com
Fri Jun 2 09:32:19 EDT 2006
bearophileHUGS at lycos.com wrote:
> python wrote:
>> after del list , when I use it again, prompt 'not defined'.how could i
>> delete its element,but not itself?
>
> This is a way:
>>>> a = range(10)
>>>> del a[:]
or simply
a = []
>>>> a
> []
>>>> a.append(20)
>>>> a
> [20]
>
> Bye,
> bearophile
>
More information about the Python-list
mailing list