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


Download files

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

Source Distribution

roman_nums-0.0.1.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file roman_nums-0.0.1.tar.gz.

File metadata

  • Download URL: roman_nums-0.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for roman_nums-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c144a6fa689459eab8d6a0b5de8402b88125d93d990c2c1825733225819b081e
MD5 a6d727a3b6f1f04191e1a28f4455969b
BLAKE2b-256 79e21832c18f8af325b402c967a7ae56d310409573201c88ffc993324942b9eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page