我写了一段代码将PHP的striplashes转换为有效的Python[反斜杠]转义:cleaned=stringwithslashescleaned=cleaned.replace('\\n','\n')cleaned=cleaned.replace('\\r','\n')cleaned=cleaned.replace('\\','')我怎样才能压缩它? 最佳答案 不完全确定这是你想要的,但是..cleaned=stringwithslashes.decode('string_escape')