利用Python处理数据,并存储为yanl格式

本文介绍了一种将王者荣耀英雄属性从txt格式转换为yaml格式的方法。通过对原始数据进行解析,并将其组织成符合yaml规范的结构,实现了每个英雄属性数据的独立存储。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天整理了一份代码,是将数据分开整理保存为yaml格式。比较简单,但也是我接触企业的算是第一个与代码有关的了。(以下数据是伪造数据,是王者荣耀的英雄属性值)

# cat data.txt 
name=孙悟空;maxLife=6585;lifeGrowth=235.1;initialLife=3293;maxMana=1760;manaGrowth=95;initialMana=430;maxPhysicalAttack=349;PhysicalAttackGrowth=13;initialPhysicalAttack=167;maxPhysicalDefense=385;PhysicalDefenseGrowth=20.79;initialPhysicalDefense=94;maxRestore5s=87;Restore5sGrowth=2.643;initialRestore5s=50;maxRestoreBlue5s=37;RestoreBlue5sGrowth=1.571;initialRestoreBlue5s=15;maxAttackSpeed=14%;mainPosition=战士;secondaryPosition=刺客-name=李白;maxLife=5483;lifeGrowth=179.6;initialLife=2968;maxMana=1808;manaGrowth=97;initialMana=450;maxPhysicalAttack=330;PhysicalAttackGrowth=11.5;initialPhysicalAttack=169;maxPhysicalDefense=358;PhysicalDefenseGrowth=18.57;initialPhysicalDefense=98;maxRest
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值