This post was updated 847 days ago and some of the ideas may be out of date.
user = {'username':'admin', 'name':'LinFei'}
# 通过in判断
print('name' in user)
print('name' in user.keys())
This post was updated 847 days ago and some of the ideas may be out of date.
user = {'username':'admin', 'name':'LinFei'}
# 通过in判断
print('name' in user)
print('name' in user.keys())
python判断字典dict指定键值是否存在
参与讨论