When to use %r instead of %s in Python? [duplicate]
The %s specifier converts the object using str(), and %r converts it using repr(). For some objects such as integers, they yield the same result, but repr() is special in that (for types where this is possible) it conventionally returns a result that is valid Python syntax, which could be used to unambiguously recreate the … Read more