美文网首页
Python入门基础:1.python入门(二)

Python入门基础:1.python入门(二)

作者: 周小钊 | 来源:发表于2020-09-23 21:12 被阅读0次

Python系列笔记

Python入门基础:1.python入门(一)

Python入门基础:1.python入门(二)

Python入门基础:2.七十二变(1)

转义字符

反斜杠+想要实现的转义功能首字母



## 转义字符
print("hello\nworld")
print("hello\tworld")
print("hello\rworld")
print("hello\bworld")
## 原字符.不希望字符串中的转义字符其作用,就使用原字符,就是在字符串之前加上r或R
print(r"hello\rworld")
## 注意事项,最后一个字符不能是反斜杠

hello
world
hello   world
world
hellworld
hello\rworld

转载请注明:周小钊的博客>>>python入门(一)

相关文章

网友评论

      本文标题:Python入门基础:1.python入门(二)

      本文链接:https://www.haomeiwen.com/subject/aefayktx.html