Is it possible, in Python, to do something similar to:
echo 'Content of $var is ', print_r($var, TRUE);
in PHP?
I have a variable var and I would like to assign its contents in a readable form to a string, for example:
str = 'Hello. '
str = str + var
You could simply use
str(var), as in:Here,
stris a built-in function, and has nothing to do with thestryou have in your script. When coding in Python, please avoid names that coincide with the names of built-in functions.An alternative way is to use the string formatting operator
%: