Skip to main content

No project description provided

Project description

roman-nums

Python library to work with roman numbers.

Installation

Use the package manager pip to install roman-nums.

pip install roman-nums

Base usage

>>> from roman_nums import to_roman, from_roman
...
>>> to_roman(154)
CLIV
>>> from_roman('MCCCXLVI')
1346

Work with validation

>>> from roman_nums.utils import rn_validator
...
>>> rn_validator('XLIV')
True
>>> rn_validator('XLIVV')
False

Work with texts

Find roman and arabic numbers in text. Convert them.

>>> from roman_nums.utils import RText
...
text = """
In 1066, Norman troops <...>.
In the XII century, England conquered Wales, and at the beginning of the XVIII century <...>.
"""

>>> worker = RText(text)
>>> worker.from_roman()
In 1066, Norman troops <...>.
In the 12 century, England conquered Wales, and at the beginning of the 18 century <...>.

>>> worker.to_roman()
In MLXVI, Norman troops <...>.
In the XII century, England conquered Wales, and at the beginning of the XVIII century <...>.

>>> worker.rnb()    # Will find all roman numbers
['XII', 'XVIII']

>>> worker.nb()     # Will find all arabic numbers
[1066]

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for roman-nums, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size roman_nums-0.0.1.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page