概念:
转义字符: 表示有特殊含义的字符,如\n表示换行,是字母newline的首字母
\t表示 制表符
print(‘hello\nworld’)
#\ +转义功能的首字母 这里的表示newline的首字符:表示换行
print(‘hello\tworld’)
#\t表示制表位
print(‘hello\rworld’) #world 将hello进行了复制
print(‘hello\bworld’) #\b是退一个格,将o退没了
print(‘http:\\www.geekyunwei.com’)
print(‘老师说:‘大家好’’)
原字符的概念:
#原字符: 不希望字符串中的转义字符起作用,就是用原字符,就是在字符串前面加上r或者R
print(r’hello\nworld’)
#注意在最后不能是\可以用\代替
输出结果:
E:\Python_demo\vippython\venv\Scripts\python.exe E:/Python_demo/vippyt