Skip to main content

Converts integers to strange number bases using customizable base definitions

Project description

python-weirdbase - Convert weird and arbitrary number bases to and from integers

Want to convert an integer to a string representation of weird number base like base36? We have you covered.

>>> import weirdbase
>>> weirdbase.int2base(12345, base=36)
'9IX'
>>> weirdbase.base2int('9IX', 36)
12345

By default, it's case-sensitive, so you can also do:

>>> weirdbase.base2int('helloThere', 62)
590996557455853334
>>> weirdbase.int2base(590996557455853334, 62)
'helloThere'

And you can convert from one weird base to another; say from base 62 to hex:

>>> weirdbase.base2base('helloThere', 62, 16)
'833A43CDEA28716'

And you can even make up your own set of digits to get weirder:

>>> weirdbase.int2base(420, base=10, chars=')!@#$%^&*(')
'$@)'
>>> weirdbase.base2int('$@)', base=10, chars=')!@#$%^&*(')
420

Installing

pip install pip+https://github.com/darrenpmeyer/python-weirdbase.git

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

weirdbase-0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

weirdbase-0.1-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file weirdbase-0.1.tar.gz.

File metadata

  • Download URL: weirdbase-0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for weirdbase-0.1.tar.gz
Algorithm Hash digest
SHA256 5c991af52b216a40f8b355109d6512793db82c6287992e1ddc36b5d504acd060
MD5 a0166b88d2c495119e0b6417954d7e3e
BLAKE2b-256 1b9cafe866c1b0109ac38a10568ca31f3f50f6cdd51966aaab0b2d3eb39f9261

See more details on using hashes here.

File details

Details for the file weirdbase-0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: weirdbase-0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for weirdbase-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 18a1abe27dc9163f6cfe302b901440b7e16d459b6ab03f49b09d64f044e10000
MD5 53f7266c9945d112632077b4ea5276a6
BLAKE2b-256 9ef64c2cead9b1982a36d928e1f2107d16258cbaa7c37397e3cdbda8231fbe97

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