You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
550 B
20 lines
550 B
# -*- coding: utf-8 -*-
|
|
import json
|
|
|
|
lines = []
|
|
|
|
with open('wq101alpha.dos', 'r') as f:
|
|
for line in f:
|
|
if line.startswith('//'):
|
|
lines.append(line)
|
|
|
|
data = {}
|
|
|
|
for i, v in enumerate(lines):
|
|
if "//alpha" in v:
|
|
data[v.replace("//", "").replace("\n", "")] = lines[i+1].replace("//", "").replace("\n", "")
|
|
|
|
# 将 data 写入当前路径中, json 文件, 命名为 wq101alpha.json
|
|
with open('wq101alpha.json', 'w') as f:
|
|
json.dump(data, f, ensure_ascii=False, indent=4)
|
|
print("wq101alpha.json 文件已生成")
|
|
|