Python3 isalpha()方法
Python 3 教程
· 2019-02-05 21:41:34
描述
Python isalpha() 方法检测字符串是否只由字母组成。
语法
isalpha()方法语法:
str.isalpha()
参数
- 无。
返回值
如果字符串至少有一个字符并且所有字符都是字母则返回 True,否则返回 False
实例
以下实例展示了isalpha()方法的实例:
#!/usr/bin/python3 str = "codercto" print (str.isalpha()) str = "Codercto example....wow!!!" print (str.isalpha())
以上实例输出结果如下:
True False
点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html