python转义字符失效的原因是什么?
python转义字符失效的原因:
1、转义字符前加了字母“r”
r 可使字符串内(除字符串最后一位是 \ 的情况)所有的转义字符 \ 都失效。
>>>print("helloworld!") helloworld! >>>print("hello\nworld!") hello world! >>>print("hello"r"\nworld!") hello\nworld!
2、在转义字符前加“\”
更多Python知识请关注Python自学网。
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.