I have a question, is there a way to \"force\" repr() to create always single quotes around a string?
repr()
This happens when I only use repr()>
Well, if your object is always a string you could do this:
def repr_single(s): return "'" + repr('"' + s)[2:] print repr_single("test'") 'test\''
But as Martijn Pieters asked I'm curious as to your use case here.