逻辑判断字符串类型,返回布尔值

1. islower

描述:判断所有字符是否为小写

语法:

    def islower(self): # real signature unknown; restored from __doc__
"""
S.islower() -> bool Return True if all cased characters in S are lowercase and there is
at least one cased character in S, False otherwise.
"""
return False

样例:

name='allen'
result=name.islower() #判断字符都为小写
print(result) True #显示结果

2. isupper

描述:判断所有字符是否为大写

语法:

    def isupper(self): # real signature unknown; restored from __doc__
"""
S.isupper() -> bool Return True if all cased characters in S are uppercase and there is
at least one cased character in S, False otherwise.
"""
return False

样例:

name='allen'
result=name.isupper() #判断所有字符为大写
print(result) False #显示结果

3. istitle

描述:判断是否为title类型,即第一个字符为大写,其他为小写

语法:

    def istitle(self): # real signature unknown; restored from __doc__
"""
S.istitle() -> bool Return True if S is a titlecased string and there is at least one
character in S, i.e. upper- and titlecase characters may only
follow uncased characters and lowercase characters only cased ones.
Return False otherwise.
"""
return False

样例:

name='Allen'
result=name.istitle() #判断是否为title类型的字符串
print(result) True #显示结果

4. isalpha

描述:判断所有字符是否为字母

语法:

  def isalnum(self): # real signature unknown; restored from __doc__
"""
S.isalnum() -> bool Return True if all characters in S are alphanumeric
and there is at least one character in S, False otherwise.
"""
return False

样例:

name = 'allen'
result=name.isalpha() #判断所有字符为字母
print(result) True #显示结果

isalpha

5. isdigit

描述:判断所有字符是否为数字

语法:

    def isdigit(self): # real signature unknown; restored from __doc__
"""
S.isdigit() -> bool Return True if all characters in S are digits
and there is at least one character in S, False otherwise.
"""
return False

样例:

name = ''
result=name.isdigit() #判断所有字符为数字
print(result) True #显示结果 name = '123abc'
result=name.isdigit() #判断所有字符为数字
print(result) False #显示结果

isdigit

6. isdecimal

描述:判断所有字符是否是十进制数

语法:

    def isdecimal(self): # real signature unknown; restored from __doc__
"""
S.isdecimal() -> bool Return True if there are only decimal characters in S,
False otherwise.
"""
return False

样例:

name = ''
result=name.isdecimal() #判断所有字符是否是十进制
print(result) True #显示结果 name = '123abc'
result=name.isdecimal() #判断所有字符是否是十进制
print(result) False #显示结果

decimal

 

最新文章

  1. Cocopod
  2. Elastic Image Slider 带缩略图功能的幻灯片
  3. css slice和splice
  4. cmd.exe-应用程序错误 应用程序无法正常启动(0xc0000142)
  5. 使用phpexecel类库导出数据
  6. 【HDOJ】2155 小黑的镇魂曲
  7. The Tips of Success(成功的建议)
  8. Ajax学习之小结
  9. hdu 1528 Card Game Cheater ( 二分图匹配 )
  10. Linux 下获取LAN中指定IP的网卡的MAC(物理地址)
  11. 从头开始学JavaScript (九)——执行环境和作用域
  12. c#抓取网页内容乱码的解决方案
  13. iOS8.0以后的相册
  14. springboot 入门三- 读取配置信息二(读取属性文件方式)
  15. linux java 和jmeter 环境变量配置文件笔记(原)
  16. Hive SQL grouping sets 用法
  17. SQL注入原理&分类&危害&防御
  18. Redis批量查询删除KEYS
  19. web和wap网站的区别 (转)
  20. Maven Oracle JDBC

热门文章

  1. MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法 -摘自网络
  2. Android 编译错误
  3. C++通过Callback向C#传递数据,注意问题
  4. 微信小程序之----加载中提示框loading
  5. IOS开发中UIAlertController(警告框)的使用
  6. 在IOS中使用DES算法对Sqlite数据库进行内容加密存储并读取解密
  7. Oracle用户权限分配
  8. ios framework 开发实战 之 参考
  9. django QuerySet里那些常用又不常见的技巧
  10. 利用cocoapods创建基于git的私有库