|
|
|
|
|
by quietbritishjim
321 days ago
|
|
I didn't know about the setdefault method, and wouldn't have guessed it lets you read a value. Interesting, thanks. Another way to get data out would be to use the new | operator (i.e. x = {} | y essentially copies dictionary x to y) or the update method or ** unpacking operator (e.g. x = {**y}). But maybe those come under the umbrella of iterating as you mentioned. |
|