您当前的位置:首页 > IT编程 > python
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 |

自学教程:Python isdigit()方法

51自学网 2023-01-09 15:59:51
  python
这篇教程Python isdigit()方法写得很实用,希望能帮到您。

描述

Python isdigit() 方法检测字符串是否只由数字组成。

语法

isdigit()方法语法:

str.isdigit()

参数

  • 无。

返回值

如果字符串只包含数字则返回 True 否则返回 False。

实例

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

#!/usr/bin/pythonstr = "123456";  # Only digit in this stringprint str.isdigit();str = "this is string example....wow!!!";print str.isdigit();

以上实例输出结果如下:

TrueFalse

Python isdecimal()方法
Python islower()方法
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1