Skip to main content

A tool for conversion numbers from one base to another, TheTechRobo edition

Project description

The library contains tools for representing natural numbers in a given base, or to current any numeral representing a natural number between two bases. Currently any base between 2 and 36 is supported.

Python-radix usage examples

Python-radix has both procedural and object-oriented solutions.

### Procedural way example

# to convert numeral 4 from base 10 to base 2 >>> cast(‘4’, 10, 2) ‘100’

# to convert the integer 4 to base 2 >>> cast(4, None, 2)

Note that since the first argument is a number, rather than a numeral, the second parameter is irrelevant, so None is used.

### Object oriented way example
>>> # create an object to find the base 2 representation of any natural number
>>> new = Converter(None, 2)
>>> new.convert(4)
'100'
>>> # create an object to find the base 2 representation of any base 10 numeral
>>> new = Converter(10, 2)
>>> new.convert('4')
'100'

Using characters as digits

# the digits 0 through 9 are succeeded by the lower case ASCII alphabet >>> cast(‘a’, 16, 10) ‘10’

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

python-radix-ng-0.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_radix_ng-0.2-py2.py3-none-any.whl (3.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python-radix-ng-0.2.tar.gz.

File metadata

  • Download URL: python-radix-ng-0.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.3

File hashes

Hashes for python-radix-ng-0.2.tar.gz
Algorithm Hash digest
SHA256 18f385722f562825d3a68972486569ada9772d2ee8f4d53b6784b5fbc12164e8
MD5 507f00765b8d822448de18797a3ecc4c
BLAKE2b-256 af085619e3cb841047b12b4d9c6387d9473f01bb7ecfad0900722d84d1bef751

See more details on using hashes here.

File details

Details for the file python_radix_ng-0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: python_radix_ng-0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.3

File hashes

Hashes for python_radix_ng-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23b58c6d8d83becadc9a60f17e921661c8bd9073b1321016d46f97443f558ea7
MD5 6ccf4a8d6c4c435ae0e400de88107fbc
BLAKE2b-256 b24f13c15ebbb2e6d752f08ed0c0315036f1e0c493ca4028b2486073d2c170b8

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