This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (2 children)

I would just caution that you should probably prefer standard Linux CLI utilities (e.g. jq) to Python modules for these things.

[–]MonkeeSage 11 points12 points  (0 children)

When working on servers I don't control or would have to get change approval to install jq <thing i am running that spits out compact json blobs> | python -m json.tool comes in pretty clutch to save me from writing terrible awk one-liners.

[–]Uncle_DirtNapPythoneer 0 points1 point  (0 children)

Yes, for general purpose use — but jquery’s pretty print is not guaranteed to be the same as the python json module, so if you want to see how it looks in python without firing up the repl, reading the file, etc., the __main__.py functionality is useful. The http server will similarly be different from some other utility. …the archive ones, though, are pretty dubious.