69pao国产精品视频-久久精品一区二区二三区-精品国产精品亚洲一本大道-99国产综合一区久久

Python isalpha()方法

Python isalpha()方法

Python 字符串Python 字符串

Python isalpha() 方法檢測字符串是否只由字母組成。

 

語法

isalpha()方法語法:

str.isalpha()

 

參數(shù)

  • 無。

 

返回值

如果字符串至少有一個字符并且所有字符都是字母則返回 True,否則返回 False。

 

實例

以下實例展示了isalpha()方法的實例:

#!/usr/bin/python
# coding=utf-8

str = "cofdebaoku"; 
print str.isalpha();

str = "cofdebaoku<a href="http://m.aalaour.cn" target="_blank">碩編程</a>"; 
print str.isalpha();

str = "this is string example....wow/b64/";
print str.isalpha();

以上實例輸出結(jié)果如下:

True
False
False

Python 字符串Python 字符串

下一節(jié):Python isdecimal()方法

Python 教程

相關(guān)文章