Python语言基础
Python语言进阶
Python数据结构

Python islower()方法

搞懂Python islower()方法的用法
<<< Python 字符串

描述

islower() 方法检测字符串是否由小写字母组成。

语法

islower()方法语法:
str.islower()

参数

无。

返回值

如果字符串中包含至少一个区分大小写的字符,并且所有这些(区分大小写的)字符都是小写,则返回 True,否则返回 False

实例

以下实例展示了islower()方法的实例:
str = "LIDIHUO example....wow!!!"
print (str.islower())
str = "lidIHuo Example....wow!!!"
print (str.islower())
以上实例输出结果如下:
False
False

Python string更多操作说明

Python String操作方法
capitalize()
第一个字符转换为大写
center(width, fillchar)
返回一个指定的宽度的字符串
count(str, beg= 0,end=len(string))
返回出现次数
bytes.decode(encoding="utf-8", errors="strict")
解码给定的 bytes 对象
encode(encoding='UTF-8',errors='strict')
对字符串进行编码
endswith(suffix, beg=0, end=len(string))
检查是否以 obj 结束
expandtabs(tabsize=8)
把字符串中的tab转为空格
find(str, beg=0, end=len(string))
检测是否包含某个字符串
index(str, beg=0, end=len(string))
跟find()方法相同
isalnum()
所有字符是字母或数字返回True
isalpha()
所有字符都是字母返回True
isdigit()
字符串只包含数字返回True
islower()
字符都是小写返回True
isnumeric()
字符串只包含数字返回 True
isspace()
字符串中只包含空白返回True
istitle()
字符串是标题化的返回 True
isupper()
字符串都是大写返回True
join(seq)
以指定字符串作为分隔符
len(string)
返回字符串长度。
ljust(width[, fillchar])
返回一个原字符串左对齐
lower()
转换大写字符为小写。
lstrip()
截掉字符串左边的字符。
maketrans()
创建字符映射的转换表
max(str)
返回字符串中最大的字母。
min(str)
返回字符串中最小的字母。
replace(old, new [, max])
替换将字符串
rfind(str, beg=0,end=len(string))
类似于find()函数
rindex( str, beg=0, end=len(string))
类似于index()
rjust(width,[, fillchar])
返回一个原字符串右对齐
rstrip()
删除字符串末尾的空格。
split(str="", num=string.count(str))
以str为分隔符截取字符串
splitlines([keepends])
按照行分隔返回元素的列表
startswith(substr, beg=0,end=len(string))
是否是以指定子字符串开头
strip([chars])
执行 lstrip()和 rstrip()。
swapcase()
将字符串中大写转换为小写
title()
返回"标题化"的字符串
translate(table, deletechars="")
转换和过滤掉的字符
upper()
转换字符串中的小写为大写。
zfill(width)
返回长度为width的字符串
isdecimal()
只包含十进制字符返回true
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4