常见转义字符

好久不见!我是兔飞飞!前段时间考完这学期所有考试了,玩了两个星期哈哈!现在开始学习!

常见转义字符列表

转义字符 含义 示例 输出
\n 换行符(newline) print("Hello\nWorld") HelloWorld
\t 制表符(tab,相当于跳到下一个对齐点) print("Hello\tWorld") Hello World
\\ 反斜杠本身 print("This is a backslash: \\") This is a backslash: \
\' 单引号 print('It\'s a test') It's a test
\" 双引号 print("He said: \"Hello\"") He said: "Hello"
\r 回车符(carriage return) print("Hello\rWorld") World
\b 退格符(backspace) print("Helloo\bWorld") HelloWorld
\f 换页符(form feed) 通常较少使用
\a 响铃符(alert) print("\a") 可能听到系统的响铃声
\v 垂直制表符(vertical tab) print("Hello\vWorld") Hello World(没显示出来,应该是垂直显示的)
\0 空字符(null character) print("Hello\0World") HelloWorld(不影响显示)
相关推荐
PedroQue991 小时前
Vite插件v0.2.6:架构优化与自动化升级
前端·vite
threerocks2 小时前
什么?我连 A2A、MCP 都没学会,现在又来了 AG-UI、A2UI.
前端·aigc·ai编程
牛奶3 小时前
如何自己写一个浏览器插件?
前端·chrome·浏览器
亿元程序员3 小时前
为什么Cocos都4.0了还有人用2.x?
前端
MomentYY4 小时前
AI 到底是“懂”,还是在“猜”?
前端·人工智能·ai编程
鹏毓网络科技4 小时前
Cursor Rules 文件配置实战:3 个隐藏参数让我每月少写 40% 样板代码
前端·github
没烦恼3014 小时前
无痕模式下 HTTP\-First 拦截引发的“页面刷新”误判
前端
文心快码BaiduComate4 小时前
从个人提效到组织提效:Comate辅助构建自我进化的AI研发系统
前端·程序员
hunterandroid4 小时前
Compose 状态管理:remember、rememberSaveable 与状态提升
前端
星栈5 小时前
Dioxus 接数据库最容易写歪的 3 个地方:sqlx + SQLite 怎么接才顺
前端·rust·前端框架