Skip to main content

Convert numbers between different numeral systems.

Project description

nsystems

Info

This Python package is used for converting any number from any numeral system (ex. binary), to whatever numeral system you want (if it's not greater than base64).

Python offers this function, but it is very limited (you can only convert bases: 2, 8, 16). With our user-friendly package, you'll be able to convert between any numeral systems (> base64).

 


Installation

It's dead easy.

You just run:

pip install nsystems

in your terminal.

 


Usage

We made our package pretty easy to use.

 

Common functions

  • convert()
  • base2()
  • base8()
  • base10()
  • base16()
  • base32()
  • base64()

 

convert()

This function is used to convert a number from, to whatever numeral system you want.

Arguments taken Type Default value
value str (no default value)
to_base int 16
from_base int 10

Example:

from nsystems import convert

converted = convert('123', 2)
print(converted)

# output: 1111011

 

base2(), base8(), base16(), base32(), base64()

These functions are very similar to each other, so we've put them in one explanation. These are also similar to the convert() function, but have like the to_base argument fixed to the base they are.

Arguments taken Type Default value
value str (no default value)
from_base int 10

Example:

from nsystems import base64

converted = base64('123')
print(converted)

# output: 1x

 

base10()

This function converts to base10 (decimal) from any other numeral system.

Arguments taken Type Default value
value str (no default value)
from_base int 16

Example:

from nsystems import base10

converted = base10('1111011', 2)
print(converted)

# output: 123

 

PRO functions

  • characters()

 

characters()

If you want to change the character list, this function is for that.

The default character list are these characters (0-9, A-Z, a-z, +, =).

With this function you can choose whether you want to get large or small letters first, and the two special characters at the end (the numbers are always at the beginning).

Arguments taken Type Default value
AZ_or_az str (options: 'AZ' or 'az') (no default value)
az_or_AZ str (options: 'AZ' or 'az') (no default value)
special_character_1 str (no default value)
special_character_2 str (no default value)

Example:

from nsystems import characters

characters('az', 'AZ', '+', '/')

# now the character list is: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/

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

nsystems-0.1.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

nsystems-0.1.0-py3-none-any.whl (4.3 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