Replacing %s by %r accordingly