转义字符 ’\‘

一、转义字符是一类特殊的字符:

1、展示无法’看见‘的字符

2、与语言本身语法有冲突的字符

\n   换行

\t    横向制表符

\'    单引号

>>> print('hello \n world')
hello 
 world
>>> print('hello \\n world')
hello \n world

\n 换行

\r 回车


二、原始字符:

>>> print(r'hello \n world')
hello \n world


猜你喜欢

转载自blog.csdn.net/weixin_41355124/article/details/80310303