#判断空白字符
space_str = " " #space 空白
print(space_str.isspace())
#常用
# space_str.isalnum() 字符是全是数字或者字母 返回 True
# space_str.isdecimal() 只包含数字 返回 True
# space_str.istitle() 是标题话的每个单词的首字母大写 返回true
# space_str.islower() 中包含至少区分大小写的字母 ,并且所有这些(区分大小写的字符都是小写 返回true)
# space_str.isupper() 中包含至少区分大小写的字母 ,并且所有这些(区分大小写的字符都是大写 返回true)
# space_str.isnumeric() 只包含数字 返回 True 全角数字,汉字数字
hello_str = "hi hello"
#判断是否以指定字符串开始
print(hello_str.startswith("Hello"))
#判断是否以指定字符串结尾
print(hello_str.endswith("hello"))
#查找指定字符串
#index 同样可以查找字符串在大字符串中的索引 如果没有数据 会报错
#fand 如果指定的字符串不存在 会返回 -1 不报错
print(hello_str.find("llo"))
#替换字符串
#replace 方法执行完成后 ,会返回一个新的字符串
#注意:不会修改原有字符串的内容
print(hello_str.replace("hello","python"))