Python中处理字符串之islower()方法的使用简介

yipeiwu_com7年前Python基础

 islower()方法判断检查字符串的所有的字符(字母)是否为小写。
语法

以下是islower()方法的语法:

str.islower()

参数

  •     NA

返回值

如果字符串中的所有字符是小写且有至少有一个字符此方法返回true,否则返回false。
例子

下面的例子显示 islower()方法的使用。

#!/usr/bin/python

str = "THIS is string example....wow!!!"; 
print str.islower();

str = "this is string example....wow!!!";
print str.islower();

当我们运行上面的程序,它会产生以下结果:

False
True


相关文章

pyqt4教程之实现半透明的天气预报界面示例

复制代码 代码如下:# -*- coding: cp936 -*-import sysimport urllib2import jsonfrom PyQt4 import QtCore,...

利用python获得时间的实例说明

复制代码 代码如下:import time  print time.time()  print time.localtime(time.time())  p...

对Python中一维向量和一维向量转置相乘的方法详解

对Python中一维向量和一维向量转置相乘的方法详解

在Python中有时会碰到需要一个一维列向量(n*1)与另一个一维列向量(n*1)的转置(1*n)相乘,得到一个n*n的矩阵的情况。但是在python中, 我们发现,无论是“.T”还是...

python中函数默认值使用注意点详解

当在函数中定义默认值时,值初始化只会进行一次,就是执行到def methodname时执行。看下面代码: from datetime import datetime def te...

python使用内存zipfile对象在内存中打包文件示例

复制代码 代码如下:import zipfileimport StringIO class InMemoryZip(object):    def __in...