How to represent a value as a syntactically correct string

repr does what you want, on most built-in types at least.

2 Likes