增加括号,优化执行顺序,增加打印代码

main
roger 2 years ago
parent 5763774e89
commit 3d9659c1b9
  1. 3
      blue_forecast.py

@ -51,7 +51,7 @@ def dict_sort(_dict, _key, _reverse=False):
result_val_dict = {} result_val_dict = {}
for rv in result: for rv in result:
result_val_dict[rv[0]] = rv[1] result_val_dict[rv[0]] = rv[1]
# print(result_val_dict)
return result_val_dict return result_val_dict
@ -59,6 +59,7 @@ def dict_rate(_dict):
_sum = reduce((lambda x, y: x + y), _dict.values()) _sum = reduce((lambda x, y: x + y), _dict.values())
for k, v in _dict.items(): for k, v in _dict.items():
_dict[k] = str(round(v / _sum * 100, 2)) + '%' _dict[k] = str(round(v / _sum * 100, 2)) + '%'
# print(_dict)
return _dict return _dict

Loading…
Cancel
Save