filepath = input('请输入文件名称:')
city_list = pocess_json_file(filepath)
city_list.sort(key=lambda city: city['aqi'])
# 列名
lines = []
lines.append(list(city_list[0].keys()))
for city in city_list:
lines.append(list(city.values()))
f = open('aqi.csv', 'w', encoding='utf-8', newline='')
writer = csv.writer(f)
for line in lines:
writer.writerow(line)
f.close()