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://www.codercto.com/courses/l/10.html

查看所有标签

MongoDB

MongoDB

Kristina Chodorow / O'Reilly Media / 2013-5-23 / USD 39.99

How does MongoDB help you manage a huMONGOus amount of data collected through your web application? With this authoritative introduction, you'll learn the many advantages of using document-oriented da......一起来看看 《MongoDB》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具