7 Star 19 Fork 1

Comitaro / Master Duel 汉化版本切换

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test.py 550 Bytes
一键复制 编辑 原始数据 按行查看 历史
Comitaro 提交于 2023-02-15 12:56 . feat: 初次提交
from hint import CardRawData
import json
import random
from typing import TypeVar
with open("./resources/card copy.json", "r", encoding="utf8") as f:
archived_Data: CardRawData = json.load(f)
T = TypeVar("T")
def delete_randomly(l: list[T], rate: float = 0.1) -> list[T]:
"""
以rate的概率随机删除列表中的元素
"""
return [i for i in l if random.random() > rate]
# save
with open("./resources/card.json", "w", encoding="utf8") as f:
json.dump(delete_randomly(archived_Data), f, ensure_ascii=False, indent=4)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fetiss/master-duel-chinese-switch.git
git@gitee.com:fetiss/master-duel-chinese-switch.git
fetiss
master-duel-chinese-switch
Master Duel 汉化版本切换
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891