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

查看所有标签

Java Servlet & JSP Cookbook

Java Servlet & JSP Cookbook

Bruce W. Perry / O'Reilly Media / 2003-12-1 / USD 49.99

With literally hundreds of examples and thousands of lines of code, the Java Servlet and JSP Cookbook yields tips and techniques that any Java web developer who uses JavaServer Pages or servlets will ......一起来看看 《Java Servlet & JSP Cookbook》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码