# 变量名.capitalize():将字符串第一个字符转换为大写
str1='hello world good bye'
print(str1.capitalize())
# Hello world good bye
# 变量名.title():将字符串,每个单词首字母转换为大写
new=str1.title()
print(str1.title())
# Hello World Good Bye
# 变量名.lower():在字符串中大写变小写
new=str1.lower()
print(str1.lower())
# hello world good bye
# 变量名.upper():在字符串中小写变大写
print(new.upper())
# HELLO WORLD GOOD BYE
# 删除
# lstrip():删除字符串左侧空白字符
str1=' hello world good bye'
print(str1.lstrip())
# hello world good bye
# rstrip():删除字符串右侧空白字符
str1='hello world good bye '
print(str1.rstrip())
# hello world good bye
# strip():删除字符串两侧空白字符
str1=' hello world good bye '
print(str1.strip())
# hello world good bye
# 判断真假
# stratswith():判断字符串某段的开始是否为指定子串开头
mystr='hello world and itcast and itheima and python'
print(mystr.startswith('and',12,19))
# true
print(mystr.startswith('and',3,19))
# false
# 变量名.endswith():看结尾是不是某个字符串
# 变量名.isalpha():满足(至少一个字符,并且都是字母)则为true
# 变量名.isdigit():满足(至少一个字符,并且都是数字)则为true
# 变量名.isalnum():满足(至少一个字符,并且都是数字或者字母)则为true
# 变量名.isspace():满足(至少一个字符,并且都是空格)则为true