19 lines
496 B
Python
19 lines
496 B
Python
import json
|
|
import yaml
|
|
|
|
def convert():
|
|
# Open and load JSON data
|
|
with open("stats.json", 'r') as json_file:
|
|
data = json.load(json_file) # Load JSON properly
|
|
|
|
# Convert and write YAML data to a file
|
|
with open("stats.yaml", 'w') as yaml_file:
|
|
yaml.dump(data, yaml_file, default_flow_style=False) # Ensure readable YAML format
|
|
|
|
print("Data saved to stats.yaml") # Print success message
|
|
|
|
def main():
|
|
convert()
|
|
|
|
if __name__ == "__main__":
|
|
main() |