老是忘记的字典排序
amount_total = 0
for subscription_type, product_info in bill_group_dict.items():
consume_group_doc_lst["subscription_type"] = subscription_type
consume_group_doc_lst["billing_date_begin"] = billing_date_begin
consume_group_doc_lst["billing_date_end"] = billing_date_end
for product_name, amount in product_info.items():
amount_total += amount
consume_group_doc_lst["product_name"] = product_name
consume_group_doc_lst["amount"] = amount
price_dict[product_name] = amount
sorted_dict = {k: v for k, v in sorted(price_dict.items(), key=lambda item: item[1], reverse=True)}
for key, value in sorted_dict.items():
count_list.append(value)
str_content += f'{key}: {float(value)}¥\n'
consum_total = '总消费:' + str(round(sum(count_list), 2)) + '¥'
content = str_content + consum_total
print(content)
天天向上,空杯心态。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2020-03-28 kafka与Rocketmq的区别【转】