|
发表于 2025-3-10 14:59:27
|
显示全部楼层
import datetime
# 示例输入数据
data = {
"date": "3月1日",
"name": "姓名-主体-剧名-roi自动1.23",
"account_name": "skhd-jz-贸腾-番茄-a-dy-超小-y2-7434",
"account_id": "1821099895177356",
"balance": 690.84,
"daily_consumption": 1315.30,
"new_customer_cost": 132,
"roi": 1.02,
"recharge_amount": 2000
}
template = """
充值 {date}:{name}
当日消耗 :{consumption:.2f}
当日新客成本:{new_customer_cost}
当日回本率:{roi:.2f}
账户名称:{account_name}
ID:{account_id}
余额:{balance:.2f}
充值金额:{recharge_amount}
"""
# 生成报告
result = template.format(
date=data['date'],
name=data['name'],
consumption=data['daily_consumption'],
new_customer_cost=data['new_customer_cost'],
roi=data['roi'],
account_name=data['account_name'],
account_id=data['account_id'],
balance=data['balance'],
recharge_amount=data['recharge_amount']
)
print(result)
# 使用方式:
# 1. 修改data字典中的值为实际数据
# 2. 千分位数字可直接使用带逗号格式(程序会自动处理)
# 3. 运行脚本即可生成格式化报告 |
|