python转义字符失效的原因: 1、转义字符前加了字母“r” r 可使字符串内(除字符串最后一位是 的情况)所有的转义字符 都失效。 >>> print("hello world!") hello world! >>> print("hellon world!") hello world! >>> print("hello"r"n world!") hellon world! 2、在转义字符前加“” 更多Python知识请关注Python自学网。