探究Python中isalnum()方法的使用
作者:goldensun 时间:2021-12-05 19:05:31
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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
利用ASP在线维护数据库
2007-10-12 13:53:00
![](https://img.aspxhome.com/file/UploadPic/200710/12/20071012135842950s.jpg)
python环境路径配置以及命令行运行脚本
2023-09-19 21:19:05
![](https://img.aspxhome.com/file/2023/9/61999_0s.png)
flash与asp/php/asp.net通信的方法第1/3页
2023-11-15 03:43:03
MYSQL在一个字段值前面加字符串
2010-10-14 14:28:00
如何用SQLMail建立一个电子刊物自动处理系统?
2010-06-13 14:36:00
python 用pandas实现数据透视表功能
2022-04-23 02:49:40
![](https://img.aspxhome.com/file/2023/7/65217_0s.png)
Python产生一个数值范围内的不重复的随机数的实现方法
2023-09-19 21:48:09
基于Python实现五子棋游戏
2023-01-29 21:47:42
![](https://img.aspxhome.com/file/2023/1/65911_0s.jpg)
python里运用私有属性和方法总结
2023-03-29 15:33:57
![](https://img.aspxhome.com/file/2023/0/69050_0s.png)
如何学习Python time模块
2023-07-30 17:14:59
PHP convert_cyr_string()函数讲解
2023-06-05 00:43:42
![](https://img.aspxhome.com/file/2023/4/55394_0s.png)
Python命令行解析器argparse详解
2023-06-14 01:08:14
一段ASP单页显示文件夹下所有图片的代码
2011-02-28 11:23:00
PHP PDOStatement::fetchAll讲解
2023-06-14 15:54:26
Python实现注册、登录小程序功能
2022-12-03 17:50:11
![](https://img.aspxhome.com/file/2023/6/68326_0s.png)
通过屏蔽IP来防止采集
2007-08-19 15:28:00
sql分类汇总及Select的自增长脚本
2012-07-21 14:40:14
面向对象的CSS
2009-07-03 12:23:00
谈谈网页设计中的字体应用 (3) 实战应用篇·上
2009-11-24 13:09:00
![](https://img.aspxhome.com/file/UploadPic/200911/24/202939796-72s.gif)
提醒各位一下,IE透明会失效的
2009-03-31 12:48:00
![](https://img.aspxhome.com/file/UploadPic/20093/31/icon_lol-37s.gif)