https://github.com/hexagoncore/input_num
Python package - input_num is like input but it only accepts numbers.
https://github.com/hexagoncore/input_num
input-number number number-input numbers only-numbers python python-package python-packages terminal-based
Last synced: 3 months ago
JSON representation
Python package - input_num is like input but it only accepts numbers.
- Host: GitHub
- URL: https://github.com/hexagoncore/input_num
- Owner: HexagonCore
- License: mit
- Created: 2021-07-06T09:49:28.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-10T15:17:12.000Z (about 3 years ago)
- Last Synced: 2025-02-03T22:04:47.836Z (4 months ago)
- Topics: input-number, number, number-input, numbers, only-numbers, python, python-package, python-packages, terminal-based
- Language: Python
- Homepage:
- Size: 143 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](#/)
[](#/)
[](#/)
[](#/)
[](#/)
# input_num
Python package - **input_num** is like input but it **only accepts numbers**
___
### ## Installation
* ### Windows / macOS
Run `python3 -m pip install input_num`
* ### Linux
Run `python3 -m pip install input_num`
### ## 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
* ### Windows / macOS
Run `python3 -m pip uninstall input_num`
* ### Linux
Run `python3 -m pip uninstall input_num`###
## FAQ
* ### Question
Answer
### 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