#coding:utf-8
'''
isspace功能:
isspace判断字符串是否是一个由空格组成的字符串
isspace用法:
booltype = string.isspace() -->无参数可传,返回一个布尔类型
ps:由空格组成的字符串,不是空字符串
istitle功能:
istitle:判断字符串是否是一个标题类型(字母大写开头)
istitle用法:
booltype = String.istitle() -->无参数可传,返回一个布尔类型
isupper:判断字符串中的字母是否都是大写
islower:判断字符串中的字母是否都是小写
Ps:只检测字符串里的字母,对其他字符不做判断
'''
print(' '.isspace())
print('hello xiaomu'.isspace())
print('Hello Xiaomu '.istitle())
print('hello world'.istitle())
print('HELLO WORLD'.isupper())
print('hello worlD'.islower())
print('hello world'.islower())
python-字符串isspace和istitle的用法
最新推荐文章于 2022-08-14 22:02:05 发布