I have a question, is there a way to "force" repr()
to create always single quotes around a string?
This happens when I only use repr()
print repr("test")
'test'
print repr("test'")
"test'"
print repr("test"")
'test"'
print repr("test'"")
'test'"'
so the last one actually does, what I want, but I don't want to add always "
to get the single quotes.
Edit: I am not going to mark an answer as accepted since, as pointed out by @martijn-pieters, I was using repr()
for purposes it is not intended for.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…