How to clear Python formula without doing my_dict = {}?

If the variable my_dict is global, you cannot:

 my_dict = {} 

which simply create a new link in the local area.

Also, I found it disgusting to use the global , so how can I remove a dict using its methods?

+4
source share
5 answers

Use clear() method?

Documentation - (docs.python.org)

+8
source

do you mean like .clear() ?

+3
source
 my_dict.clear() 
+1
source

my_dict.clear ()

+1
source
+1
source

All Articles