#转义字符
print('hello\nworld')
#\n表示换行
print('hello\tworld')
print('helloooo\tworld')
#\t表示制表符,4个字母为一个制表位
#第一句输出结果为hello world,中间三个空格,其中hell占一个制表位,o和三个空格占一个制表位,后面接world
#第二句输出结果为helloooo world,中间四个空格,其中hell占一个制表位,oooo占一个制表位,四个空格占一个制表位,后接world
print('hello\rworld')
print('my\rschool')
#\r表示回车,world对hello进行了覆盖,school对my进行了覆盖
#注意:覆盖时跟前面有多少个字母无关
print('hello\bworld')
#\b表示退格,退一个格将o退没了
print('http:\\\\www.baidu.com')
#\\中第二个\表示转义符号,所以出现两个\\时只会输出一个\,我们想让他输出两个\\就要在输出语句中写四个\\\\
print('老师说:\'大家好\'')
print('老师说:‘大家好’')
#用英文冒号时必须加\'不然会报错,中文‘’可以直接输出
#原字符:不希望字符串中的转义字符起作用就要使用原字符,即在字符串前面加上r或者R即可
#转义字符不起作用把他当做普通字符输出
print(r'hello\nworld')
#注意:字符串最后一个字符不能是\反斜杠
#print(r'hello\nworld\')报错
print(r'hello\nworld\\')
运行结果: