Skip to main content

Convert numbers from base 10 integers to base X strings and back again.

Project description

Copyright (c) 2010, 2011, 2012, 2015 Guilherme Gondim. All rights reserved.

Copyright (c) 2009 Simon Willison. All rights reserved.

Copyright (c) 2002 Drew Perttula. All rights reserved.

Description:

Python module to convert numbers from base 10 integers to base X strings and back again.

Author(s):

Drew Perttula, Simon Willison, Guilherme Gondim

License:

Python Software Foundation License version 2

Project website:

https://github.com/semente/python-baseconv

References:

http://www.djangosnippets.org/snippets/1431/ ; http://code.activestate.com/recipes/111286/

Install and Usage Instructions

You can use pip to install baseconv module:

$ pip install python-baseconv

Sample usage:

>>> base20 = BaseConverter('0123456789abcdefghij')
>>> base20.encode(1234)
'31e'
>>> base20.decode('31e')
'1234'
>>> base20.encode(-1234)
'-31e'
>>> base20.decode('-31e')
'-1234'
>>> base11 = BaseConverter('0123456789-', sign='$')
>>> base11.encode('$1234')
'$-22'
>>> base11.decode('$-22')
'$1234'

License information

See the file “LICENSE” for terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.

This baseconv distribution contains no GNU General Public Licensed (GPLed) code, just like prior baseconv distributions.

All trademarks referenced herein are property of their respective holders.

Django

The Django Project includes a copy of this module on django.utils.baseconv.

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-baseconv-1.1.3.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file python-baseconv-1.1.3.tar.gz.

File metadata

File hashes

Hashes for python-baseconv-1.1.3.tar.gz
Algorithm Hash digest
SHA256 d29961e6e8bc5851a1d9ecbb13703f0d70991dc86350839efaaac34067da4a7e
MD5 5935cfbd84fdbf8921eb60b3aba108e0
BLAKE2b-256 08055d8c6a2604a576813d299ec294b27e9044fbd08dc649bcf9485299be0c0d

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