Skip to main content

Base 26 Encoder and Decoder

Project description

b26 - Base 26 Encoder and Decoder

A common example usage is alphabetical counting: When 'Z' is reached, the next items will be 'AA', 'AB' and so on.

Installation

pip install b26

Basic Usage

import b26

for i, item in enumerate([
    "Apples",
    "Banana",
    "Pineapple",
    ...,
]):
    print(f"{b26.encode(i)}. {item}")

API

decode()

decode(string: str) -> int

Converts an alphabetical string into an integer.

Parameters

string A string that only consists of ASCII letters to convert into an integer.

encode()

encode(integer: int) -> str

Convert an integer into an alphabetical string.

Parameters

integer A positive integer or 0 to convert into a string.

Returns

An uppercase alphabetical string.

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

b26-0.0.1.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

b26-0.0.1-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

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