当前位置: 首页 > Python编程 > Python编程实战技能 > Python编程学习教程 > python中反斜杠是什么意思

python中反斜杠是什么意思

发布时间:2020年11月19日 01:36:56 来源:环球青藤 点击量:1519

【摘要】1、python本身使用来转义一些特殊字符,比如在字符串中加入引号的时候 s = & 39;i& 39;m superman& 39; print(s) i& 39;m su

1、python本身使用来转义一些特殊字符,比如在字符串中加入引号的时候

s = 'i'm superman'
print(s)    # i'm superman

2、Python中反斜杠也可以用在一行结尾做续行符使用。

例:

hello = "This is a rather long string containingn
several pnes of text just as you would do in C.n
    Note that whitespace at the beginning of the pne is
 significant."
  
print(hello)

注意,其中的换行符仍然要使用 n 表示——反斜杠后的换行符被丢弃了。以上例子将如下输出:

This is a rather long string containing
several pnes of text just as you would do in C.
    Note that whitespace at the beginning of the pne is significant.

Python中的转义字符:

更多Python相关技术文章,请访问Python教程栏目进行学习!

以上就是小编分享的关于python中反斜杠是什么意思的详细内容希望对大家有所帮助,更多有关python教程请关注环球青藤其它相关文章!

分享到: 编辑:wangmin

就业培训申请领取
您的姓名
您的电话
意向课程
点击领取

环球青藤

官方QQ

扫描上方二维码或点击一键加群,免费领取大礼包,加群暗号:青藤。 一键加群

绑定手机号

应《中华人民共和国网络安全法》加强实名认证机制要求,同时为更加全面的体验产品服务,烦请您绑定手机号.

预约成功

本直播为付费学员的直播课节

请您购买课程后再预约

环球青藤移动课堂APP 直播、听课。职达未来!

安卓版

下载

iPhone版

下载
环球青藤官方微信服务平台

刷题看课 APP下载

免费直播 一键购课

代报名等人工服务

课程咨询 学员服务 公众号

扫描关注微信公众号

APP

扫描下载APP

返回顶部