Skip to main content

Easier input for Python

Project description

Autoinput

This library is for easier input in Python. It is 100% that you don't want to do this:

while 1:
  try:
    x = int(input())
    break
  except:
    print("Please input a number")

because it is 6 lines when you can have 1 line:

x = autoinput("", autoinput_type.INTEGER)

and everything is inside the function. No work by hands.

how to use

Here is the definition

def autoinput(outstring: str, typeel, pipe_in: Callable[[str], str]=input, pipe_out: Callable[[str], None]=print, pipe_out_end_name: str="end", pipe_out_flush_name: str="flush", parser=None) -> Any:

First argument - outstring, string to show.

Second argument - typeel, use autoinput_type enum to form this (example: autoinput_type.INTEGER | autoinput_type.ARRAY)

kwargs:

pipe_in - for custom input function (for example if you use GUI)

pipe_out - for custom output function

parser - for custom parser (don't use with autoinput_type except of autoinput_type.ARRAY)

pipe_out_end_name - if your custom output function doesn't have parameter like print's end use None, if has but called not end use the parameter to specify the name.

pipe_out_flush_name - the same as pipe_out_end_name but for flush.

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

autoinput-1.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

autoinput-1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file autoinput-1.2.tar.gz.

File metadata

  • Download URL: autoinput-1.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for autoinput-1.2.tar.gz
Algorithm Hash digest
SHA256 479f3b427fb875cb5462e398bf7dfecd74cd086ebf904502132acff35e113eb9
MD5 7b25d5e592df05ab4e0ef48b59d6d0d0
BLAKE2b-256 9876d1dc9954cd27d2f928b19ba527f5876bc868ce2b1bd8726bab4f6d8753f2

See more details on using hashes here.

File details

Details for the file autoinput-1.2-py3-none-any.whl.

File metadata

  • Download URL: autoinput-1.2-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.2

File hashes

Hashes for autoinput-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9f0554af1f2d9cac35bc07f7ae6b2661207208ccbe7d37d5d945ae8869c4484
MD5 aa74974444109d3df321cdf27f3f3993
BLAKE2b-256 1c13966bc21ebd5ea2d596864e7720d87ddf6b6a95abe908e5507536b89e7fd9

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