python的字符串内建函数5

2025-05-22 09:42:49

python中string模块有很多字符串的方法,下面简单列几个方法。

python的字符串内建函数5

工具/原料

电脑

python

字符串内建函数:

1、string.isdecimal():如果string只包含十进制数字,则返回True,否则返回False。

python的字符串内建函数5
python的字符串内建函数5

2、string.isdigit():如果string中只包含数字,则返回True,否则返回False。

python的字符串内建函数5
python的字符串内建函数5

3、string.islower():如果string中区分大小写的字符都是小写,则返回True,否则返回False。

python的字符串内建函数5
python的字符串内建函数5

4、string.isnumeric():如果string中只包含数字,则返回True,否则返回False。

python的字符串内建函数5
python的字符串内建函数5
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢