
input_num
Python package - input_num is like input but it only accepts numbers
Installation
Usage
-
Windows / macOS / Linux
Add this to your script: import input_num
input_num("Enter your age: ")
Command scheme: input_num("Question: ", AllowNegativeNumbers, DoesPressingEnterReturnNothing)
-
First option:
If you want to allow only positive numbers (numbers WITHOUT - at the begining), use input_num("Something", False)
.
False just means Allow negative numbers = False
And it is optional argument
Default value is True
-
Second option:
There is also second option, does pressing enter return "" ? Set it to False to make pressing enter ask you again.
Example: input_num("Try pressing enter: ", True, False)
- this allows negative numbers and disallows entering nothing.
It is optional argument
Default value is True
⚠️ If you want to set only second option, set the first option too ⚠️
Do you want to be reminded to update the package?
Run input_num.allow_update()
RIGHT AFTER importing the package.
Uninstallation
FAQ
Do you like this? Hit that ⭐!
Use the star button as way to show us, that it works
Forks and pull requests are welcome of course