您现在的位置是:课程教程文章
python转义字符失效的原因是什么?
2023-12-18 18:35课程教程文章 人已围观
python转义字符失效的原因:
1、转义字符前加了字母“r”
r 可使字符串内(除字符串最后一位是 \ 的情况)所有的转义字符 \ 都失效。
>>> print("hello world!") hello world! >>> print("hello\n world!") hello world! >>> print("hello"r"\n world!") hello\n world!
2、在转义字符前加“\”
更多Python知识请关注Python自学网。
课程教程:python转义字符失效的原因是什么?上一篇:python怎么用画散点图?
下一篇:没有了