Python Module to display Dictionairies for debugging - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Python Module to display Dictionairies for debugging (/thread-27748.html) |
Python Module to display Dictionairies for debugging - personalt - Jun-19-2020 I have a python application that has three threads that maintain three dictionaries with lists of work that are being processed. As a way to debug I am looking for a module that will allow me to monitor those three dictionaries as records are added or deleted. I have no experience with python GUIs so not sure what i might need.. I definitely want to keep it simple here. the displaying of the dictionaries really only needs to run in my dev environment. I can do the legwork and learn the tool, I just dont know what tool to look at. RE: Python Module to display Dictionairies for debugging - Gribouillis - Jun-19-2020 If I had to do this I would perhaps try the ttk.Treeview wigdet in tkinter to display the dictionaries as tables. RE: Python Module to display Dictionairies for debugging - Larz60+ - Jun-20-2020 or: def display_dict(dictname, level=0): indent = " " * (4 * level) for key, value in dictname.items(): if isinstance(value, dict): print(f'\n{indent}{key}') level += 1 display_dict(value, level) else: print(f'{indent}{key}: {value}') if level > 0: level -= 1 RE: Python Module to display Dictionairies for debugging - Yoriz - Jun-20-2020 You could use an IDE's debugging to view contents of variables for instance VS code VS code General Debugging Python debug configurations in Visual Studio Code |