Difficult-Rocket/libs/utils/parse_toml.py

14 lines
250 B
Python
Raw Normal View History

2022-11-01 18:34:02 +08:00
import json
import pprint
import sys
import tomlkit
with open(sys.argv[1], encoding='utf-8', mode='r') as f:
if sys.argv[2] == 'parse':
a = tomlkit.load(f)
else:
a = json.load(f)
print(a)
2022-11-01 23:22:39 +08:00
pprint.pprint(a, width=100)