clinput.multi module¶
-
clinput.multi.
boolean
(message, err='Please only enter 1s (True) or 0s (False).', sep=' ')¶ Command line input and error checking for boolean values (1 or 0).
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter 1s (True) or 0s (False).”.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of boolean values.
Return type: list of [bool,]
-
clinput.multi.
custom
(message, allowed, err='Invalid input.', sep=' ')¶ Command line input and error checking for user-defined allowable inputs.
Parameters: - message (str) – The input message displayed in the command line.
- allowed (tuple of (str,)) – The allowable user inputs.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Invalid input.”.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of allowed strings.
Return type: list of [str,]
-
clinput.multi.
integer
(message, err='Please only enter integers.', sep=' ')¶ Command line input and error checking for integers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter integers.”.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of integers.
Return type: list of [int,]
-
clinput.multi.
natural
(message, err='Please only enter positive integers.', zero=False, sep=' ')¶ Command line input and error checking for natural numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter positive integers.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to False.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of natural numbers.
Return type: list of [int,]
-
clinput.multi.
negative
(message, err='Please only enter negative numbers.', zero=True, sep=' ')¶ Command line input and error checking for negative numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter negative numbers.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to True.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of negative numbers.
Return type: list of [float,]
-
clinput.multi.
number
(message, err='Please only enter numbers.', sep=' ')¶ Command line input and error checking for numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter numbers.”.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of numbers.
Return type: list of [float,]
-
clinput.multi.
positive
(message, err='Please only enter positive numbers.', zero=True, sep=' ')¶ Command line input and error checking for positive numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please only enter positive numbers.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to True.
- sep (str, optional) – The character used to separate inputs. Defaults to ” “.
Returns: The first sucessfully input list of positive numbers.
Return type: list of [float,]