当前位置:网站首页>How to judge whether the input content is "number"
How to judge whether the input content is "number"
2022-07-07 22:26:00 【Happy learning Python】
When you want users to enter a number , Will use input function , however input The function does not restrict what the user enters , Users can also enter string or other format content .
Run the following code :

When the user enters the correct number , Output is as follows :

When user input error , Output is as follows

If you want users to input numbers as required, you need to judge the user's input content and then output .
Because the string content cannot be converted to floating point (float), You can convert user input to floating point (float) As the result of the True still False To judge .
Run the following code

If the input is not a number , Output is as follows :

边栏推荐
- npm uninstall和rm直接删除的区别
- Revit secondary development - collision detection
- 【colmap】稀疏重建转为MVSNet格式输入
- Reptile combat (VII): pictures of the king of reptiles' heroes
- Dbsync adds support for mongodb and ES
- MIT6.S081-Lab9 FS [2021Fall]
- 双塔模型的最强出装,谷歌又开始玩起“老古董”了?
- TCP/IP 协议栈
- Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
- Antd date component appears in English
猜你喜欢

【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)

PKPM 2020软件安装包下载及安装教程

Ueeditor custom display insert code

What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk

. Net automapper use

UWA问答精选

OpenGL configuration vs2019
![VTOL in Px4_ att_ Control source code analysis [supplement]](/img/7a/4ce0c939b9259faf59c52da2587693.jpg)
VTOL in Px4_ att_ Control source code analysis [supplement]

如何实现横版游戏中角色的移动控制

如何选择合适的自动化测试工具?
随机推荐
Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
Kaggle-Titanic
Win11游戏模式怎么开启?Win11开启游戏模式的方法
Remember aximp once Use of exe tool
Matplotlib drawing interface settings
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
Record problems fgui tween animation will be inexplicably killed
强化学习-学习笔记9 | Multi-Step-TD-Target
Jerry's test box configuration channel [chapter]
[azure microservice service fabric] start the performance monitor in the SF node and set the method of capturing the process
Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
Record a garbled code during servlet learning
Which futures company is the safest to open a futures account?
OpenGL job - texture
How to make agile digital transformation strategy for manufacturing enterprises
VTOL in Px4_ att_ Control source code analysis [supplement]
Revit secondary development - wall opening
[open source] Net ORM accessing Firebird database
Crawler (17) - Interview (2) | crawler interview question bank
This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘