Stay With us
3 new comments

beginner
new

Help & Settings
About
Help
Tips

Apply try except to get items from dictionary in python

I have a dictionary containing user name and age. I can use the name attribute to get name. But if it does not exist then python shows me the error.

I want to write try except in my programme so that it does not break. How can i write that and get that error message that name does not exists.

(1) Replies

Please login or register to Comment or Answer