# 换行符 \n
print('换行符=====', 'hello\nbao')
# 制表符 \t
print('hello\tbaoa')
# 一个制表符表示四个空格,满四个字符时才会重开一个制表符
print('helloooo\tbaoa')
# 回车符,\r,光标移到本行的开头
print('回车符=====', 'hello\rbao')
# 退格,\b,回退一个空格
print('退格=====', 'hello\bbao')
# 反斜杠,使特殊字符生效
print('反斜杠=====', 'D:\\bao')
print('单引号=====', 'ni\'hao\'')
print('双引号=====', "da\"bao\"")
# 源字符
print('源字符r=====', r'hello\nworld')
print('源字符R=====', R'hello\bbao')
返回结果:
换行符===== hello
bao
hello baoa
helloooo baoa
bao
退格===== hellbao
反斜杠===== D:\bao
单引号===== ni'hao'
双引号===== da"bao"
源字符r===== hello\nworld
源字符R===== hello\bbao