What's the quickest way to make a new dictionary (minus one key) out of an old one without changing the original?
e.g.
input= {potato : 10, book2 : 182, book17 : 12}
make a new dict without book2 without changing the original input
returning = {potato : 10, book17 : 12}
copy first
d_returning = dict(d_input)
Then delete
del d_returning['book2']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With