A better input() for python
Project description
UpgradedInput
A better, minimal input() wrapper for python
Features compared to python's default input()
- Supports hooks for functions (Before and after input, on exception and on runtime error)
- Supports automatic conversion with validation
How to use
Install the module
pip install UpgradedInput
Use the module Example:
from UpgradedInput import UpgradedInput, InputTypes
# initialize
inp = UpgradedInput()
# Example of hooks (All of them can be left at the dafult state (None))
def before():
print("Before!")
def after():
print("After!")
def exception():
print("Exception!")
def runtime_error():
print("Runtime error!")
# Initialize the hooks
inp.before_input_function = before
inp.after_input_function = after
inp.exception_close_input_function = exception
inp.runtime_error_function = runtime_error # say we lost sys.stdin or something else that triggers a runtime error
print(inp.input()) # final call to the wrapper
print(inp.input(prompt="insert text: ")) # supports prompt (from input)
print(inp.input(type=InputTypes.INTEGER)) # supports automatic conversion!
print(inp.input(type=InputTypes.FLOAT)) # floats
print(inp.input(type=InputTypes.BOOL)) # booleans
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
upgradedinput-0.0.7.1.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upgradedinput-0.0.7.1.tar.gz.
File metadata
- Download URL: upgradedinput-0.0.7.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05775d66fca60bfcc2fa6b6688a448023dd3c09c22778aaad130ab3d88aecc7a
|
|
| MD5 |
98d1dfcb8df4995f6ade545fa2ac5d1d
|
|
| BLAKE2b-256 |
d53377c2a3534c2ab7a56a37c68cd290b4775c28b9c29ebaf5ca7c8c06f3e2f0
|
File details
Details for the file upgradedinput-0.0.7.1-py3-none-any.whl.
File metadata
- Download URL: upgradedinput-0.0.7.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9b88c9634365ac95d1c909f9367db24826ecc0928907d9b9f9aa6c1e2554b6
|
|
| MD5 |
019092170fc1b88d50a34831c60f8e0d
|
|
| BLAKE2b-256 |
2ec0553ea49ef83c812d8c95152e074ba8d9d1b5fdd0518462a32960f020e391
|