标签: python
为什么x的输出不是单引号y?到目前为止,我的猜测是,因为x内部有一个单引号,如果用单引号打印它会让它变得尴尬。我怎样才能防止这种情况发生?是否必须对转义序列做些什么?
x
y
x = "-Why's that?" y = "-What are you talking about dude?" print ("%r\n%r")% (x, y)
输出:
"-Why's that?" '-What are you talking about dude?'