Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- def run():
- """Load data.json file and put into format."""
- with open("data.json", "r") as f:
- contents = json.loads(f.read())
- for cls in contents.get("classes", []):
- class_name = cls.get("name")
- for spec in cls.get("specializations"):
- spec_name = spec.get("name")
- for ability in spec.get("abilities"):
- name = ability.get('name')
- ab_id = ability.get('id')
- image_url = ability.get('imageUrl')
- print(f"Class: {class_name} - {spec_name}\nName: {name}\nId: {ab_id}\nImageUrl: {image_url}\n")
- if __name__ == '__main__':
- run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement