多平台统一管理软件接口,如何实现多平台统一管理软件接口
309
2022-08-30
Python-字典(练习题)
"""练习题"""cities = { 'Wuhan': { 'country': 'China', 'population': '1700', 'fact': 'nice' }, 'New York':{ 'country': 'America', 'population': '1600', 'fact': 'good' }, 'Paris':{ 'country': 'French', 'population': '1000', 'fact': 'normall' }}for city_name,city_info in cities.items(): print('city_name:'+city_name) country = city_info['country'] population = city_info['population'] fact = city_info['fact'] print('country:'+country+'\t'+'population:'+population+'\t'+'fact:'+fact+'\n')"""添加键和值"""cities['Wuhan']['history'] = 100print(cities.items())"""修改键和值"""cities['Wuhan']['history'] = 50print(cities.items())"""删除键和值"""del cities['Wuhan']['history']print(cities.items())
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~