Python3 isalnum()方法

Python 3 教程 · 2019-02-05 21:27:01

描述

isalnum() 方法检测字符串是否由字母和数字组成。

语法

isalnum()方法语法:

str.isalnum()

参数

  • 无。

返回值

如果 string 至少有一个字符并且所有字符都是字母或数字则返回 True,否则返回 False

实例

以下实例展示了isalnum()方法的实例:

实例(Python 2.0+)

#!/usr/bin/python3 str = "codercto2016" # 字符串没有空格 print (str.isalnum()) str = "www.codercto.com" print (str.isalnum())

以上实例输出结果如下:

True
False

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

查看所有标签

Design systems

Design systems

Not all design systems are equally effective. Some can generate coherent user experiences, others produce confusing patchwork designs. Some inspire teams to contribute to them, others are neglected. S......一起来看看 《Design systems》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试