Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

upgradedinput-0.0.7.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for upgradedinput-0.0.7.1.tar.gz
Algorithm Hash digest
SHA256 05775d66fca60bfcc2fa6b6688a448023dd3c09c22778aaad130ab3d88aecc7a
MD5 98d1dfcb8df4995f6ade545fa2ac5d1d
BLAKE2b-256 d53377c2a3534c2ab7a56a37c68cd290b4775c28b9c29ebaf5ca7c8c06f3e2f0

See more details on using hashes here.

File details

Details for the file upgradedinput-0.0.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for upgradedinput-0.0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9b88c9634365ac95d1c909f9367db24826ecc0928907d9b9f9aa6c1e2554b6
MD5 019092170fc1b88d50a34831c60f8e0d
BLAKE2b-256 2ec0553ea49ef83c812d8c95152e074ba8d9d1b5fdd0518462a32960f020e391

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page