how can I clear a dictionary in python

Christian Tismer tismer at
Thu Mar 29 01:02:28 CEST 2007

On 29.03.2007, at 00:48, Larry Bates wrote:

> Marko.Cain.23 at wrote:
>> Hi,
>> I create a dictionary like this
>> myDict = {}
>> and I add entry like this:
>> myDict['a'] = 1
>> but how can I empty the whole dictionary?
>> Thank you.
> just point myDict to an empty dictionary again
> myDict={}

This is wrong and not answering the question.
Creating a new dict does not change the dict.
He wants to clear *this* dict, and maybe he
cannot know how many other objects are
referring to this dict.

cheers -- chris

"""pointless questions or useless answers - what do you like more"""

More information about the Python-list mailing list