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.1.tar.gz (4.1 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.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: srinputs-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 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.1.tar.gz
Algorithm Hash digest
SHA256 6a4889f55547d46055c69c81a48f6c9f26fbb1f81b9a8f970b8f0ad723be07be
MD5 fb903e0e7cd6af81ad134f0efb04d528
BLAKE2b-256 48d1fa19c9b5e43e5fa18dd8da1dfb3bb35cc36bee7b76e2efb2cc43c553421e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: srinputs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 781757b41cb01a3c8043e60d41d26adc57dd511b6877775b5d176eb1e9979603
MD5 4c8a50136a85d0c3a8129342cc7e9292
BLAKE2b-256 8f83b7ee4aca9e79ba661cef9bb3d96135fefaa525627c933a2f2def94b3d33a

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