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

查看所有标签

Web Operations

Web Operations

John Allspaw、Jesse Robbins / O'Reilly Media / 2010-6-28 / USD 39.99

A web application involves many specialists, but it takes people in web ops to ensure that everything works together throughout an application's lifetime. It's the expertise you need when your start-u......一起来看看 《Web Operations》 这本书的介绍吧!

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

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器