Apr-09-2022, 03:10 PM
I got this to work
import json file = "character.json" with open(file, 'r') as rfile: character = json.load(rfile) for character_class, data in character.items(): print(f'Class: {character_class.title()}') for stats in data: temp_list = [] for key, value in stats.items(): if isinstance(value, dict): for k, v in value.items(): temp_list.append(f'{k}: {v}') string = ', '.join(temp_list) else: string = value print(f'{key.upper()}: {string}') print()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags