>>> print "hellp \
... world"
hellp world
2、 \' \" 单引号和双引号 转义字符
>>> print "hello \"world"
hello "world
3、 \r 光标
>>> print "Hello \rWorld!"
World!
4、 \t 横向制表符(tab 键)
>>> print "hello \t world!"
hello world!
5、 \v 纵向制表符
>>> print "hello \v world!"
hello
world!
6、 \n 换行符,打印到下一行
>>> print "hello \n world!"
hello
world!
7、如果不想用转义字符生效的话,可以使用r来制定显示原始字符
>>> print "hello \nworld!"
hello
world!
>>> print r"hello \nworld"
hello \nworld
有问题请加博主微信进行沟通!
全部评论