Coding Global Background
Coding Global

Print JSON Keys

Archiviert 3 years ago
3 Nachrichten
2 Mitglieder
3 years ago
In Discord öffnen
I
ItIzYe
Verified

Hi, I'm working on a To do script and i currently have this JSON file: ```json { "todos": { "label": { "edu": {}, "work": { "jkl": { "description": "jkl", "timer": "jkl" }, "cvb": { "description": "cvb", "timer": "vcb" }, "yxc": { "description": "yxc", "timer": "yxc" }, "uio": { "description": "uio", "timer": "uio" }, "asd": { "description": "asd", "timer": "asd" }, "wer": { "description": "wer", "timer": "wer" } }, "personal": {} } } } ``` and i use this loop to print: ```py if yn.lower() == "y": for key in data['todos']['label']['work']: print(data['todos']['label']['work'][key]) ``` i want to get the keys in "work" to get printed, however i only get the values. Can somebody help me find a solution?

Antworten (3)