A Simple and Easy to Use Input Parsing Library
There are only 5 simple Functions
prompt
: the message to show when asking for input
message
: The Message to Print out if the validation failed
The parsed integer
Takes in the same arguments as ask_int
The parsed float
Will Keep asking for input until the input is a valid boolean, in that case returns the parsed boolean
Takes in the same arguments as ask_int
and ask_float
The parsed boolean
Will keep asking for input until the input is found in a given iterable, in that case return the input that was found
The iterable is automatically converted to a set so the lookup time is much faster
The items in the iterable are automatically converted to a string
So [1, 2.0, print, "hi", True]
becomes: ["1", "2.0", "print", "hi", "True"]
, so the input can be parsed
prompt
: the message to show when asking for input
ask_in
: The iterable that will be looked in with given input
message
: The Message to Print out if the validation failed
The input that was found in the iterable
Will Keep asking for input until the input is a matched by a regex pattern, in that case returns the input that matched
prompt
: the message to show when asking for input
pattern
: the regex pattern that matches the input
message
: The Message to Print out if the validation failed
The input that matched the regex pattern