mystr='a project is a task that requires a lot of time and efforts'
newstr='less is more'
senstr='lessismore'
thstr='12323'
forstr='sasd33'
fivstr=' '
print(mystr.find('p')) #查找字符串中是否包含特定字符,有则返回下标,否则false
print(mystr.index('p')) #同上
print(mystr.count('p'))#查找字符串中特定字符出现的次数
print(mystr.title())#字符串中每个首字母大写
print(mystr.lower())#字符串中每个字母小写
print(mystr.upper())#字符串中每个字母大写
print(mystr.split(' '))#按分割符分割字符
print(mystr.replace('t', 'W'))#替换字符内容
print(mystr.capitalize())#字符串第一个字母大写
print(mystr.lstrip())#从字符串左侧开始去除空格
print(mystr.rstrip())#从字符串右侧开始去除空格
print(newstr.startswith('1'))#检测字符串是否以某个字母开头
print(newstr.endswith('e'))#检测字符串是否以某个字母结尾
print(senstr.isalpha())#检测字符串是否全部都是字母
print(thstr.isdigit())#检测字符串是否全部都是数字
print(thstr.isalnum())#检测字符串是否全部都是字母或数字
print(fivstr.isspace())#检测字符串是否全部都是空格
mystr='a project is a task that requires a lot of time and efforts'
newstr='less is more'
senstr='lessismore'
thstr='12323'
forstr='sasd33'
fivstr=' '
print(mystr.find('p')) #查找字符串中是否包含特定字符,有则返回下标,否则false
print(mystr.index('p')) #同上
print(mystr.count('p'))#查找字符串中特定字符出现的次数
print(mystr.title())#字符串中每个首字母大写
print(mystr.lower())#字符串中每个字母小写
print(mystr.upper())#字符串中每个字母大写
print(mystr.split(' '))#按分割符分割字符
print(mystr.replace('t', 'W'))#替换字符内容
print(mystr.capitalize())#字符串第一个字母大写
print(mystr.lstrip())#从字符串左侧开始去除空格
print(mystr.rstrip())#从字符串右侧开始去除空格
print(newstr.startswith('1'))#检测字符串是否以某个字母开头
print(newstr.endswith('e'))#检测字符串是否以某个字母结尾
print(senstr.isalpha())#检测字符串是否全部都是字母
print(thstr.isdigit())#检测字符串是否全部都是数字
print(thstr.isalnum())#检测字符串是否全部都是字母或数字
print(fivstr.isspace())#检测字符串是否全部都是空格