num2fawords

A tool to convert numbers (int, float) into Persian words


Keywords
convert, number, words, farsi, persian, converter, number-conversion, numbers, python
License
GPL-3.0
Install
pip install num2fawords==1.0.dev0

Documentation

image

image

image

num2fawords

num2fawords is a highly customizable library which provides functions to convert a number (int, float, Decimal, Fraction, or str) into Persian word form.

Installation

  • Python 3.4+ is required
  • pip install 'setuptools>=36.2.1'
  • pip install num2fawords

Usage

Obviously, words is used to convert to word form and ordinal_words is for ordinal word from.

words also accepts other common standard types:

The default decimal separator is "و" but it can be changed to "ممیز" (or any other string) as follows:

Some people prefer, for example, "صد و هفتاد" over its other form "یکصد و هفتاد". This library uses the second form by default which is also used on official Iranian banknotes. But it can be changed:

Some examples for other arguments of `words`:

Of-course the above arguments can be used together.

If you prefer to change the default argument values once and for all, use the change_defaults function:

That's all. Enjoy!