1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
.. image:: https://github.com/zopefoundation/roman/actions/workflows/tests.yml/badge.svg
:target: https://github.com/zopefoundation/roman/actions/workflows/tests.yml
.. image:: https://coveralls.io/repos/github/zopefoundation/roman/badge.svg?branch=master
:target: https://coveralls.io/github/zopefoundation/roman?branch=master
.. image:: https://img.shields.io/pypi/v/roman.svg
:target: https://pypi.org/project/roman/
:alt: Current version on PyPI
.. image:: https://img.shields.io/pypi/pyversions/roman.svg
:target: https://pypi.org/project/roman/
:alt: Supported Python versions
roman
=====
Small helper library to convert arabic to roman numerals.
There are two ways to use this library.
1. Importing it into your application
.. code-block:: python
import roman
# to roman
number = int(input('> ')) # 10
print(roman.toRoman(number))
# from roman
number = input('> ') # X
print(roman.fromRoman(number))
2. ``roman`` CLI command
.. code-block:: bash
~$ roman 972
CMLXXII
# use the -r/--reverse to convert Roman numerals
~$ roman -r CMLXXII
972
# case insensitive
~$ roman -r cMlxxii
972
|