一、python自身应用\来本义一些非凡字符,比方正在字符串中退出引号的时分
s = 'i\'m superman' print(s) # i'm superman
二、Python中反斜杠也能够用正在一行末端做续行符应用。
例:
hello = "This is a rather long string containing\n\ several lines of text just as you would do in C.\n\ Note that whitespace at the beginning of the line is\ significant." print(hello)
留意,此中的换行符依然要应用 \n 示意——反斜杠后的换行符被抛弃了。以上例子将以下输入:
This is a rather long string containing several lines of text just as you would do in C. Note that whitespace at the beginning of the line is significant.
Python中的本义字符:
更多Python相干技巧文章,请拜访Python教程栏目进行学习!
以上就是python中反斜杠是甚么意义的具体内容,更多请存眷资源魔其它相干文章!
标签: python教程 python编程 python使用问题 python中反斜杠是什么意思
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。
抱歉,评论功能暂时关闭!