Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing python compatible code #19

Open
Jaymon opened this issue Jan 27, 2017 · 1 comment
Open

Printing python compatible code #19

Jaymon opened this issue Jan 27, 2017 · 1 comment

Comments

@Jaymon
Copy link
Owner

Jaymon commented Jan 27, 2017

Every once in a while I want to print a dict or something with pout and use that in actual python code, pout's dictionaries and lists are close to valid but not quite, which is annoying, I think I should add a py method that basically just does:

json.dumps(data, sort_keys=True, indent=4)

This will print valid dicts and lists and stuff, other things would have to be used for classes and the like (or an error raised).

@Jaymon
Copy link
Owner Author

Jaymon commented Dec 28, 2017

import ast
r = list(range(10))
ast.literal_eval(r)

might be handy here (via)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant