Skip to main content

Number Base Converter

Project description

Number Base Converter by v01d

Converts string representation from one base to another

Installation

From PyPI (recommended)

Via pip

$ pip install --user nbc

Via pipenv

$ pipenv install nbc

From GitLab

$ git clone https://gitlab.com/v01d-gl/number-base-converter.git
$ cd number-base-converter
$ python setup.py install --user

Docs

convert(number, to_base, from_base)
number: from_base whole number (as String) to convert
to_base: New base [2; 36]
from_base: Old base [2; 36] (default 10)
return: to_base number as a String

Wrong to_base/from_base range raises ValueError
Int number raises TypeError
Unexpected symbols in number raise ValueError

Example

from nbc import convert


convert('15', 2)  # '1111'
convert('10F', to_base=8, from_base=16)  # '417'
convert('1', 30)  # '1'

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

nbc-1.1.3.tar.gz (2.0 kB view hashes)

Uploaded Source

Supported by

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