Python isalpha()方法

Python 教程 · 2019-02-02 12:14:23

描述

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

点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html

查看所有标签

Developer's Guide to Social Programming

Developer's Guide to Social Programming

Mark D. Hawker / Addison-Wesley Professional / 2010-8-25 / USD 39.99

In The Developer's Guide to Social Programming, Mark Hawker shows developers how to build applications that integrate with the major social networking sites. Unlike competitive books that focus on a s......一起来看看 《Developer's Guide to Social Programming》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具