Created
September 19, 2025 17:52
-
-
Save AshtonIzmev/31d0c66a3bd121cf1a261501cb1cdd71 to your computer and use it in GitHub Desktop.
Coucou dataviz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def diciter(d, pad="", list_idx=0): | |
| for k, v in d.items(): | |
| if isinstance(v, str): | |
| print(f"{pad}KEY: {k} -> {v[:100]}") | |
| elif isinstance(v, int) or isinstance(v, float) or isinstance(v, bool): | |
| print(f"{pad}KEY: {k} -> {v}") | |
| elif isinstance(v, dict): | |
| print(f"{pad}KEY: {k} ") | |
| diciter(v, pad + " ") | |
| elif isinstance(v, list): | |
| if isinstance(v[list_idx], dict): | |
| print(f"{pad}KEY: {k}") | |
| diciter(v[list_idx], pad + " ") | |
| else: | |
| print(f"{pad}KEY: {k} -> {v[list_idx]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment