explain the difference between del and clear in dictionary with an example
Answers
Answered by
7
Answer:
clear() removes every key, so basically their behavior is the same. On the memory issue, in Python when you "delete" you are basically removing a reference to an object. ... clear() will free the memory of the hashset used in the dict, while removing the key will not.
Similar questions
Math,
2 months ago
Social Sciences,
2 months ago
English,
5 months ago
Physics,
11 months ago
Math,
11 months ago