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.4.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

nsystems-0.4.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nsystems-0.4.0.tar.gz.

File metadata

  • Download URL: nsystems-0.4.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for nsystems-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4f1089c8bd98d5ab65f99d2496d96fdd1660c8a8082e8a15b10af74120267f54
MD5 645a1c5799474aaa22f4e3754c9df32f
BLAKE2b-256 f270cd9018e976090b41649407bba9fd901176d5d175ffeffa448a9e5824a263

See more details on using hashes here.

File details

Details for the file nsystems-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: nsystems-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for nsystems-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52a2de5f9356db283d4943f40521329368dabdda54967c3b8711245d1771f589
MD5 a98a22f31bca61c5c440a047f8daf143
BLAKE2b-256 c1aebf3863e32e79fb29723bc41730aecc53495c989eb0af16ea5e20a536b5d4

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