>>> s = 'my string with \"double quotes\" blablabla'>>> s'my string with \"double quotes\" blablabla'>>> print smy string with "double quotes" blablabla>>>
当您只要求’s’时,它会为您转义,在打印时,您会看到字符串处于更“原始”状态。所以现在
>>> s = """my string with "double quotes" blablabla"""'my string with "double quotes" blablabla'>>> print s.replace('"', '\"')my string with "double quotes" blablabla>>>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)