首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

Python - 基本数据类型_str 字符串

print("反斜杠 \\ 是什么") print("换行符是什么 \\n") # 输出结果 反斜杠 \ 是什么 换行符是什么 \n window 路径的栗子 print("c:\nothing\rtype...") print("c:\\nothing\\rtype") # 输出结果 c:\nothing\ c: type c:\nothing\rtype 更简洁的解决方法 用转义符会导致可读性、维护性变差...,Python 提供了一个更好的解决方法:在字符串前加 r print(r"c:\nothing\rtype") # 输出结果 c:\nothing\rtype 关于更多 r"" 的讲解请看:https...print(str[-1]) print(str[-5]) # 输出结果 h e w d l 如果是负数,那么是倒数,比如 -1 就是倒数第一个元素,-5 就是倒数第五个元素 获取字符串中一段字符 Python...-1] worl hello world'[::-1] dlrow olleh hello world'[::2] hlowrd hello world'[1:7:2] el 字符串的函数 Python

35430

扫码

添加站长 进交流群

领取专属 10元无门槛券

手把手带您无忧上云

扫码加入开发者社群

相关资讯

热门标签

活动推荐

    运营活动

    活动名称
    广告关闭
    领券