Answers for "orderd dictionary pop vs del"

1

orderd dictionary pop vs del

pop returns the value of deleted key.
Basically, d.pop(key) evaluates as x = d[key]; del d[key]; return x.

Use pop when you need to know the value of deleted key
Use del otherwise
Posted by: Guest on March-14-2021

Browse Popular Code Answers by Language