python学习第二天 pyhon字符串操作

s='cescesc'

print(s.isupper)#判断是不是都是大写字母

print(s.isdigit)#判断是否位为数字

print(s.islower)#判断是不是小写字母

number=input('请输入要产生几条:')

print(s.index('d'))#找不到报错

print(s.find('d'))找不到报-1

s.count('a')统计多少个出现

s.strip()两边空格

s.lstrip()左空格去除

s.rlstrp()右边空格去除

s.startswith()#判断以什么开头

s.endswith()判断以什么结尾

猜你喜欢

转载自www.cnblogs.com/weilemeizi/p/11511196.html