Why?? The square brackets are right there and they work


I don’t agree with saying .get is always the correct way. Using [] is valid when you want an exception if the key is missing, depending on your specific needs.


While using .get() in Python is excellent for handling missing dictionary keys, it’s not the only ‘right way.’ Square brackets are fine if you're sure the key exists and want a KeyError. Don't buy into dogma—this isn't Go, where there’s only 'the Go way.'

kubertai's tweet image. While using .get() in Python is excellent for handling missing dictionary keys, it’s not the only ‘right way.’ Square brackets are fine if you're sure the key exists and want a KeyError. Don't buy into dogma—this isn't Go, where there’s only 'the Go way.'

ya the get method won't give any err if the key is not present in the obj


If u use square brackets or get method the result will be 20


hunter python ninjas become web3 legends embrace the future


what if age has a child element?


United States Trendler
Loading...

Something went wrong.


Something went wrong.