手机
当前位置:查字典教程网 >脚本专栏 >python >探究Python中isalnum()方法的使用
探究Python中isalnum()方法的使用
摘要:isalnum()方法检查判断字符串是否包含字母数字字符。语法以下是isalnum()方法的语法:str.isa1num()参数NA返回值如...

isalnum()方法检查判断字符串是否包含字母数字字符。

语法

以下是isalnum()方法的语法:

str.isa1num()

参数

NA

返回值

如果字符串中的所有字符字母数字和至少有一个字符此方法返回 true,否则返回false。

例子

下面的例子显示了isalnum()方法的使用。

#!/usr/bin/python str = "this2009"; # No space in this string print str.isalnum(); str = "this is string example....wow!!!"; print str.isalnum();

当我们运行上面的程序,它会产生以下结果:

True False

【探究Python中isalnum()方法的使用】相关文章:

python调用shell的方法

Python列表推导式的使用方法

python中的sort方法使用详解

python条件和循环的使用方法

Python下singleton模式的实现方法

Python splitlines使用技巧

Python中文件遍历的两种方法

Python中的jquery PyQuery库使用小结

python中mechanize库的简单使用示例

Python中的CURL PycURL使用例子

精品推荐
分类导航