python-forum.org

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.Note: posts here are not necessarily endorsed by the community, and may represent amateur or even bad practices.

i use this function to print objects in a nice way.1. output is formatted like python code over multiple lines2. dictionaries are output in key sorted order3. dictionary keys are padded to make the same length for the same dictionary4. strings are appended with slice code to show the length5. types are appended in comments6. "empty" follows the type for empty subobjects7. the name passed in the call is shown like a key unless ...8. if '=' is appended to the name then it is formatted like a variable being assigned.9. indent= indents the output by that many spaces10. file= is supported for output redirection11. it is intended to work in both python2 and python312. run it as a command to run the test

Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016. This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.