1 Star 0 Fork 0

焦建军/good_robot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
make_comp_configs.py 849 Bytes
一键复制 编辑 原始数据 按行查看 历史
from itertools import combinations
import yaml
import pathlib
import sys
def read_config(path):
with open(path) as f1:
return yaml.load(f1)
def write_config(config, path):
with open(path, "w") as f1:
yaml.dump(config, f1)
def enumerate_configs(original_path, out_path):
#colors = ['blue','red','green','yellow','gray','orange','purple','brown']
colors = ['blue','red','green', 'yellow']
combos = combinations(colors,2)
original_config = read_config(original_path)
for combo in combos:
original_config['color_pair'] = ",".join(combo)
write_config(original_config, out_path.joinpath("".join(combo) + ".yaml"))
if __name__ == "__main__":
original_config = sys.argv[1]
out_path = sys.argv[2]
enumerate_configs(pathlib.Path(original_config), pathlib.Path(out_path) )
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiaojianjun-com/good_robot.git
git@gitee.com:jiaojianjun-com/good_robot.git
jiaojianjun-com
good_robot
good_robot
master

搜索帮助