Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Number Base Converter

Project description

Number Base Converter by v01d

Converts string representation from one base to other

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


Release history Release notifications

This version

1.1.2

Download files

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

Files for nbc, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size nbc-1.1.2.tar.gz (1.7 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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page