内容简介:Python isalpha() 方法检测字符串是否只由字母组成。
描述
Python isalpha() 方法检测字符串是否只由字母组成。
语法
isalpha()方法语法:
str.isalpha()
参数
- 无。
返回值
如果字符串至少有一个字符并且所有字符都是字母则返回 True,否则返回 False
实例
以下实例展示了isalpha()方法的实例:
#!/usr/bin/python str = "this"; # No space & digit in this string print str.isalpha(); str = "this is string example....wow!!!"; print str.isalpha();
以上实例输出结果如下:
True False
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 理解实例方法、类方法、静态方法
- 【MyBatis源码分析】insert方法、update方法、delete方法处理流程(上篇)
- 【MyBatis源码分析】insert方法、update方法、delete方法处理流程(上篇)
- java:方法覆盖与方法重载
- 静态方法、实例化方法与线程安全
- JS数组方法总览及遍历方法耗时统计
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Learn Python 3 the Hard Way
Zed A. Shaw / Addison / 2017-7-7 / USD 30.74
You Will Learn Python 3! Zed Shaw has perfected the world’s best system for learning Python 3. Follow it and you will succeed—just like the millions of beginners Zed has taught to date! You bring t......一起来看看 《Learn Python 3 the Hard Way》 这本书的介绍吧!