当前位置:网站首页>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 :
边栏推荐
- [开源] .Net ORM 访问 Firebird 数据库
- 大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
- [azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
- Win11如何解禁键盘?Win11解禁键盘的方法
- 如何实现横版游戏中角色的移动控制
- JS number is insufficient, and 0 is added
- Get the exact offset of the element
- Revit secondary development - collision detection
- Revit secondary development - cut view
- Win11U盘不显示怎么办?Win11插U盘没反应的解决方法
猜你喜欢
#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
Index summary (assault version)
Antd date component appears in English
vite Unrestricted file system access to
It's worth seeing. Interview sites and interview skills
Add get disabled for RC form
How to make agile digital transformation strategy for manufacturing enterprises
Latest Android advanced interview questions summary, Android interview questions and answers
Talk about relational database and serverless
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
随机推荐
Remove the default background color of chrome input input box
[JDBC Part 1] overview, get connection, CRUD
Px4 autonomous flight
DNS series (I): why does the updated DNS record not take effect?
Reinforcement learning - learning notes 9 | multi step TD target
Tsconfig of typescript TS basics JSON configuration options
Latest Android advanced interview questions summary, Android interview questions and answers
Add get disabled for RC form
建立自己的网站(18)
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
Cannot find module 'xxx' or its corresponding type declaration
Remember an experience of using selectmany
PKPM 2020 software installation package download and installation tutorial
OpenGL configure assimp
DBSync新增对MongoDB、ES的支持
Dbsync adds support for mongodb and ES
OpenGL jobs - shaders
Revit secondary development - cut view
Remember aximp once Use of exe tool