实现一个简单的打印城市信息的类
city_info = {'广州': [0.74, 1490.44, 2285.35]}
class citys_info:
def __init__(self, city_name):
self.city_name = city_name
def get_info(self):
print(f'(2019年数据)\
城市:{self.city_name}\
面积:{city_info[self.city_name][0]}km\u00b2\
人口:{city_info[self.city_name][1]}万人\
GDP:{city_info[self.city_name][2]}亿元')
gz = citys_info('广州')
gz.get_info()
面积信息一行中u00b2的打印效果是²,即平方符号