logoalt Hacker News

lkbmtoday at 3:47 PM1 replyview on HN

I have this as a bash script and a some similar bash and python scripts for converting between python's print(my_dict) and json, or to run some python (mostly the dicts) through black.

The j2p is pretty self-evident if you know any python, and the only trick to p2j was knowing `ast.literal_eval(input_str)`.


Replies

megagpt1today at 3:58 PM

Should be print(repr(my_dict)) in case my_dict is actually a string, or you'd have an injection attack