say_digits
say_digits
Return the digits in text, one word each, as a voice should read a ZIP code, an
account number, or a phone number. Anything that isn’t a digit separates groups,
and a comma between groups makes the voice pause.
Parameters
text
The digits, with any separators.
group
How to group the digits.
None— keep the groupstextalready has, split at anything that isn’t a digit.- An
int— split the digits into groups of that size. - A sequence of sizes — split the digits into those sizes, in order, with any remaining digits in a last group.
Raises ValueError for a size below 1.
zero
Keyword-only. The word for 0, such as "oh".
Returns
str — The words, with groups separated by ", ", or "" when text has no digits.
Example
Part of the speech helpers module.