# import shelve
#
# f = shelve.open(‘shelve_text‘)
# #存
# f[‘info‘] = {‘name‘:‘xuxu‘}
# f[‘shop‘] = {‘price‘:‘100‘}
#
# #取
# dat = f.get(‘info‘)
# print(dat)
d = {‘name‘:‘xuxu‘,‘age‘:‘25‘}
print(d[‘name‘])
print(d.get(‘name‘))
print(d.get(‘sex‘))#None
print(d.get(‘sex‘,‘male‘))#没有默认值male,有的话返回正确结果
print(d.get(‘name‘,‘male‘))#xuxu