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]
Release files for roman-nums 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| roman_nums-0.0.1.tar.gz | 4.4 kB | Details |
Release files / roman_nums-0.0.1.tar.gz
| Download URL | roman_nums-0.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c144a6fa689459eab8d6a0b5de8402b88125d93d990c2c1825733225819b081e
|
|
BLAKE2b-256 checksum How to use checksums |
79e21832c18f8af325b402c967a7ae56d310409573201c88ffc993324942b9eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
|