pyinputplus library


Mon Oct 18 2021 00:36:52 GMT+0000 (UTC)

Saved by @trivent

>>> import pyinputplus as pyip
>>> help(pyip.parameters)
Help on function parameters in module pyinputplus:

    Common parameters for all ``input*()`` functions in PyInputPlus:

    * ``prompt`` (str): The text to display before each prompt for user input. Identical to the prompt argument for Python's ``raw_input()`` and ``input()`` functions.
    * ``default`` (str, None): A default value to use should the user time out or exceed the number of tries to enter valid input.
    * ``blank`` (bool): If ``True``, a blank string will be accepted. Defaults to ``False``.
    * ``timeout`` (int, float): The number of seconds since the first prompt for input after which a ``TimeoutException`` is raised the next time the user enters input.
    * ``limit`` (int): The number of tries the user has to enter valid input before the default value is returned.
    * ``strip`` (bool, str, None): If ``None``, whitespace is stripped from value. If a str, the characters in it are stripped from value. If ``False``, nothing is stripped.
    * ``allowlistRegexes`` (Sequence, None): A sequence of regex str that will explicitly pass validation.
    * ``blocklistRegexes`` (Sequence, None): A sequence of regex str or ``(regex_str, error_msg_str)`` tuples that, if matched, will explicitly fail validation.
    * ``applyFunc`` (Callable, None): An optional function that is passed the user's input, and returns the new value to use as the input.
    * ``postValidateApplyFunc`` (Callable, None): An optional function that is passed the user's input after it has passed validation, and returns a transformed version for the ``input*()`` function to return.