栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python字符串操作

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python字符串操作

#coding=utf-8
#转义字符
#n -回车
#' -'号
#" -双引号
#t -制表符
#\ -斜杠
print("Hello there !nHow are you?nI'm doing fine。n"My name is wangyongke."")
print("t Hello,I'm here.")
print("Hello,this is \.")


#原始字符串 --打印所有的字符不进行转义
print(r"Hello there!nHow are you!")
print(r'Hello,n t \ '"')


#三重引号  3个单引号或者双引号
#\ 在三重引号中也转义
print('''
Hello, there!
 How are you?
    I'm doing fine.
    \\\\\\
''')
#三重引号作为多行注释如下
'''
eg:
print('Hello')
'''





#字符串下标和切片
str01='wang yongke'
print(str01[0:4])
print(len(str01))
j=0
for i in str01:
    print(i,end="")
    print(j,end="")
    j+=1


#字符in and not in 操作
print('n')
print('w' in str01)
print('gg' not in str01)



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/224631.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号