Difficult-Rocket/libs/utils/parse_toml.py

14 lines
239 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)
pprint.pprint(a)