反斜杠 b 在 Python 中有什么作用? [英] what does backward-slash b do in Python?

查看:66
本文介绍了反斜杠 b 在 Python 中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python 中反斜杠 b 的目的是什么,我在 python 解释器中运行 print "\"foo\bar" 并得到这个结果:

what is the purpose of backward-slash b in python, I ran print "\"foo\bar" in the python interpreter and got this result:

>>>print "\"foo\bar"
"foar

推荐答案

参见 string文字文档:

\b ASCII Backspace (BS)

\b ASCII Backspace (BS)

它产生一个退格字符.打印该字符时,您的终端在第二个 o 上退格.

这篇关于反斜杠 b 在 Python 中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆