《python程式設計從入門到實踐》習題答案第6章-字典(6.11城市)
阿新 • • 發佈:2021-01-26
技術標籤:python
cities = {'beijing': {'country': 'china', 'population': '13', 'fact': 'beautiful'}, 'new york': {'country': 'usa', 'population': '3.3', 'fact': 'best'}, 'Japan': {'country': 'Tokyo', 'population': '2.3', 'fact': 'fast'}, } for city, info in cities.items(): print("\n"+city+"\n介紹:") for key,value in info.items(): print(key + ":" + value)