[oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键
转义字符
回忆上次内容
- 我们为什么会有八进制?
- 因为需要用八进制输出转义字符
- 把(
ooo
)<sub>8进制
</sub>对应的ascii
字符输出
- 把(
hh
)<sub>16进制
</sub>对应的ascii
字符输出
- 比如输出
\n
、\r
等 - 那我想只输出
\
这个字符可以吗? -
\
叫什么字符来着?🤔
转义字符
- 转义转义 转化含义
- escape character
- 可以将后面的字符转义
- 这个
\
是一个转义字符 \n
是一个转义序列
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _反斜杠](https://file.cfanz.cn/uploads/png/2023/01/16/14/3KQ9C03c8E.png)
尝试
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _进制_02](https://file.cfanz.cn/uploads/png/2023/01/16/14/86588a48Q0.png)
搜索结果
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _进制_03](https://file.cfanz.cn/uploads/png/2023/01/16/14/EBSW9b357d.png)
具体方法
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _反斜杠_04](https://file.cfanz.cn/uploads/png/2023/01/16/14/Sc7C04Hf7f.png)
输出一个反斜杠
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _转义_05](https://file.cfanz.cn/uploads/png/2023/01/16/14/168LO1eaad.png)
转义字符的输出
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _转义_06](https://file.cfanz.cn/uploads/png/2023/01/16/14/8H93K72EcR.png)
多个\
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _进制_07](https://file.cfanz.cn/uploads/png/2023/01/16/14/33V257X9L8.png)
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _反斜杠_08](https://file.cfanz.cn/uploads/png/2023/01/16/14/PEYXbHA5BF.png)
总结
- 最近玩了
\n
、\r
之外的转义序列
-
\a
是 ␇ (bell) -
\t
是 水平制表符 -
\v
是 换行不回车
-
\xhh
- 把(hh)<sub>16 进制</sub>对应的 ascii 字符输出
-
\ooo
- 把(ooo)<sub>8 进制</sub>对应的 ascii 字符输出
![图片描述 [oeasy]python0051_ 转义_escape_字符_character_单引号_双引号_反引号_ 退格键 _转义_09](https://file.cfanz.cn/uploads/png/2023/01/16/14/1B400Lc1G0.png)
- 我们下次再说!👋
- 我们下次再说!👋
- 蓝桥->https://www.lanqiao.cn/courses/3584
- github->https://github.com/overmind1980/oeasy-python-tutorial
- gitee->https://gitee.com/overmind1980/oeasypython
- 视频->https://www.bilibili.com/video/BV1CU4y1Z7gQ 作者:oeasy