Python字符串——前面加“r”的含义解释
2019-01-31 00:35
453 查看
Python字符串——前面加“r”的含义解释
注意:r必须紧贴着"写,中间不能有空格
a = r"hello \n world" a print(a)
输出结果为:
‘hello \\n world’ #字符串前加r,实际存储的是\\n
hello \n world
输出结果为原本字符(\n)。也可认为一个\为转义,两个\即不转义。
code | output |
---|---|
a | ‘hello \\n world’ |
print(a) | hello \n world |
不加r的示例
b = "hello \n world" b print(b)
输出结果为:
‘hello \n world’
hello
world \n为转义字符的换行
相关文章推荐
- python字符串前面加u,r,b的含义
- python字符串前面加u,r,b的含义
- python字符串前面加u,r,b的含义
- Python中在字符串前面加u,r,b的含义
- 【python】python字符串前面加u,r,b的含义
- python 字符串前面添加u,r,b的含义
- python字符串前面加u,r,b的含义
- python字符串前面加u,r,b的含义及字符串判空
- python字符串前面加u,r,b的含义
- python字符串前面加u,r,b的含义
- Python 字符串前面加u,r,b的含义
- python字符串前面加u,r,b的含义
- 飘逸的python - 编码杂症之在字符串前面加u
- python3.4学习笔记(二十一) python实现指定字符串补全空格、前面填充0的方法
- python字符串中的单双引号及转义解释
- Python 字符串前面加'r'
- Python 开头字符串中添加r,u的含义
- [python]去掉 unicode 字符串前面的 u(转)
- [Python][小知识] Python字符串前 加 u、r、b 的含义
- Python 字符串前面加 r