Skip to main content

A small Python package that improves the usage of the built-in input() function with functionalities such as static and multiple inputs.

Project description

SRinputs - Static Repetitive inputs

License

A small Python package that improves the usage of the built-in input() function with functionalities such as static and multiple inputs.

Instalation

You can install it using pip.

pip install SRinputs

Features

  • Type validation: Requests and validates inputs such as int, float or str.
  • Error handling: Catch KeyboardInterrupt and EOFError in a user friendly way, allowing the program to continue.
  • Mandatory entries:** Ensures that the user enters a valid value before continuing, avoiding empty entries by default.
  • Multiple entries:** Requests a specific number of entries and returns them in a list.

Usage and Examples

Here are some examples of how to use the functions to get validated inputs.

Getting a Single Validated Input

These functions will repeatedly prompt the user until a valid input of the requested data type is provided.

from SRinputs import IntInput

# Prompt for an integer, does not allow empty input by default
age = IntInput("Please enter your age: ")
print(f"Your age is: {age}")
from SRinputs import StrInput

# Prompt for a string, does not allow empty input by default
name = StrInput("Please enter your name: ")
print(f"Your name is: {name}")
from SRinputs import FloatInput

# Prompt for a float, does not allow empty input by default
price = FloatInput("Please enter the price: ")
print(f"The price is: {price}")

Getting Multiple Inputs

This function ensures a specific number of valid inputs are collected before continuing.

from SRinputs import multiInput

# Prompt for 'n' inputs, does not allow empty input by default
names = multiInput(5, "Please enter one name: ")
print(f"The names are: {names}")

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

srinputs-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

srinputs-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file srinputs-0.1.0.tar.gz.

File metadata

  • Download URL: srinputs-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for srinputs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4428da5e1a4203b11936362e1c5f99f348b73bc4dd2626e5c64688249bd90a68
MD5 d849aa15215a3ff7be44f7e6893f24a0
BLAKE2b-256 11caeefd944c40b756ffe679287dad52ed97b89b0af1e939c01ad1865f9d1ca4

See more details on using hashes here.

File details

Details for the file srinputs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: srinputs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for srinputs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc28b7bd18e4f6d55f92ce72aeba876a44aafb3af6f2dfdb4283839e9daa57b
MD5 b807f23fe44bd4384e7ae891d42228f5
BLAKE2b-256 1eab36c40d6709b971c27bdc051c5fb325fa83d2b57d33d9e7043a15abbc61df

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