string对象方法
2023-11-28 13:17:23
一:str.isalnum() ,str.isalpha(),str.isdigit() ,str.islower() ,str.isupper()
1.str.isalnum()
This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9).
>>> print 'ab123'.isalnum()
True
>>> print 'ab123#'.isalnum()
False
2.str.isalpha()
This method checks if all the characters of a string are alphabetical (a-z and A-Z).
>>> print 'abcD'.isalpha()
True
>>> print 'abcd1'.isalpha()
False
3.str.isdigit()
This method checks if all the characters of a string are digits (0-9).
>>> print '1234'.isdigit()
True
>>> print '123edsd'.isdigit()
False
4.str.islower()
This method checks if all the characters of a string are lowercase characters (a-z)
>>> print 'abcd123#'.islower()
True
>>> print 'Abcd123#'.islower()
False
This method checks if all the characters of a string are uppercase characters (A-Z).
>>> print 'ABCD123#'.isupper()
True
>>> print 'Abcd123#'.isupper()
False
最新文章
- css3过渡效果
- React Native填坑之旅--LayoutAnimation篇
- oracle11g数据库的安装以及安装之后的配置
- canvas-star6.html
- AJAX顺序输出
- Python遍历文件夹枚举所有文件类型
- javascript 用函数实现“继承”
- RHEL7重置root密码
- ajax例子
- [2015-10-11]常用git命令
- redis在Linux上的安装和简单使用
- 17_Android中Broadcast详解(有序广播,无序广播)最终广播,Bundle传递参数,传递参数的时候指定权限
- MySQL之路 ——2、步履维艰的建表
- webpack 中,module、chunk、bundle 的区别(待补充)
- Java 面试题 == 和 equals 的区别
- Ex3_15 判断图是否是一个强连通分量 判断点是否在汇点强连通分量中_十一次作业
- 【Python026--字典内键方法】
- Delphi FrieDAC 大数据处理
- java数组倒序查找值
- Gearman的使用
热门文章
- app Inventor
- loadrunner断言多结果返回
- EC20 R2.1
- 运行selenium脚本,报seleneium common exception.SessionNotCreatedException:Message:Unable to find a matching set of capabilities错误
- php操作excel表格的导入和导出
- Eclipse——在eclipse上安装Pydev插件实现python编程
- 内网环境上部署k8s+docker集群:集群ftp的yum源配置
- ES7的async/await
- Win2012 R2安装 sqlserver2017 Express
- error while loading shared libraries: libopencv_core.so.3.4: cannot open shared object file: No such file or directory