运行下面的代码行时,得到以下结果:
>>> a = ''' this " is what \"is 'needed' \" Please " '''
' this " is what "is \'needed\' " Please " '
我希望输出为:
' this " is what "is 'needed' " Please " '
问题是'
被\'
取代。
谁能建议解决此问题的方法?
答案 0 :(得分:0)
您只需要打印字符串:
a = ''' this " is what \"is 'needed' \" Please " '''
print(a)
输出:
this " is what "is 'needed' " Please "
或者,如果您真的想要外部引号:
print("'" + a + "'")
输出:
' this " is what "is 'needed' " Please " '