python转义字符失效的原因:
1、转义字符前加了字母“r”
r 可使字符串内(除字符串最后一位是 的情况)所有的转义字符 都失效。
>>> print("<a href="https://www.gaodaima.com/tag/hello" title="查看更多关于hello的文章" target="_blank">hello</a> <a href="https://www.gaodaima.com/tag/world" title="查看更多关于world的文章" target="_blank">world</a>!") hello world! >>> print("hello world!") hello world! >>> print("hello"r" world!") hello world!
www#gaodaima.com来源gao@!dai!ma.com搞$$代^@码!网搞代码
2、在转义字符前加“”
更多Python知识请关注搞代码网。
来源:搞代码网:原文地址:https://www.gaodaima.com