python基础 | 您所在的位置:网站首页 › python用什么换行 › python基础 |
\n的意思是换行 meaning of n is newline首字母表示换行
\t的意思是制表符 四个空格代表一个制表符 下面是介绍制表符的代码
print('hello\t world')
print('helloooo\t world')
运行结果 hello world helloooo world \r的意思是replace 就是把前面的东西全部替换,干掉前面的东西 \b的意思是退格的意思 print('asnkeni \r ancen') print('cneknci\b')运行结果 anceni cneknc反斜杠的意思\ , 单引号,\’ 双引号,\" 还原原来的意思 print('http:\\\\www.baidu.com\n')运行结果 http:\\www.baidu.com print('老师说\'dajiahao\'')运行结果 print('老师说\'dajiahao\'') 原字符使转义字符不起作用 使用方法:在字符串面前加一个r或R 注意事项:不能最后的字符串是反斜杠 print(r'wwwcie\njioef')运行结果 wwwcie\njioef print(r'jciwenfcie\')运行结果 Cell In[9], line 1 print(r'jciwenfcie\') ^ SyntaxError: EOL while scanning string literal#系统进行了报错,最后不能是反斜杠 |
CopyRight 2018-2019 实验室设备网 版权所有 |