Skip to main content

A simple library to convert between strings, decimal values, binary values and hexadecimal values.

Project description

Here is the code for BitConvertor, a simple library made with Python for Python to convert between strings, decimal values, binary values and hexadecimal values.


Import :

To use the library in your script, you have to import it with this Python instruction :

from bitconvertor import *



Convert decimal into... :


  • Binary :

    decimal_to_binary(integer_value)
    
    Exemple :
    binary_value = decimal_to_binary(1234)      # binary_value = 00000100 11010010
    

  • Hexadecimal :

    decimal_to_hexadecimal(integer_value)
    
    Exemple :
    hexadecimal_value = decimal_to_hexadecimal(1234)      # hexadecimal_value = 00000100 11010010
    

  • Character :

    decimal_to_character(integer_value)
    
    Exemple :
    character_value = decimal_to_character(65)      # character_value = 'A'
    

  • String :

    decimal_to_string(string_value)
    
    Exemple :
    string_value = decimal_to_string("66 111 110 106 111 117 114")      # string_value = "Bonjour"
    


Convert binary into... :


  • Decimal :

    binary_to_decimal(string_value)
    
    Exemple :
    decimal_value = binary_to_decimal("0000010011010010")      # decimal_value = 1234
    

  • Hexadecimal :

    binary_to_hexadecimal(string_value)
    
    Exemple :
    hexadecimal_value = binary_to_hexadecimal("0000010011010010")      # hexadecimal_value = 04 D2
    

  • Character :

    binary_to_char(string_value)
    
    Exemple :
    character_value = binary_to_char("01000010")      # character_value = 'B'
    

  • String :

    binary_to_string(string_value)
    
    Exemple :
    string_value = binary_to_string("01000010 01101111 01101110 01101010 01101111 01110101 01110010")      # string_value = "Bonjour"
    



Convert hexadecimal into... :


  • Decimal :

    hexadecimal_to_decimal(string_value)
    
    Exemple :
    decimal_value = hexadecimal_to_decimal("04 D2")      # decimal_value = 1234
    

  • Binary :

    hexadecimal_to_binary(string_value)
    
    Exemple :
    binary_value = hexadecimal_to_binary("04 D2")      # binary_value = 0000010011010010
    

  • Character :

    hexadecimal_to_char(string_value)
    
    Exemple :
    character_value = hexadecimal_to_char("41")      # character_value = 'A'
    

  • String :

    hexadecimal_to_string(string_value)
    
    Exemple :
    string_value = hexadecimal_to_string("42 6F 6E 6A 6F 75 72")      # string_value = "Bonjour"
    



Convert character into... :


  • Decimal :

    char_to_decimal(character_value)
    
    Exemple :
    decimal_value = char_to_decimal('A')      # decimal_value = 65
    

  • Binary :

    char_to_binary(character_value)
    
    Exemple :
    binary_value = char_to_binary('A')      # binary_value = 01000001
    

  • Hexadecimal :

    char_to_hexadecimal(character_value)
    
    Exemple :
    hexadecimal_value = char_to_hexadecimal('A')      # hexadecimal_value = 41
    



Convert string into... :


  • Decimal :

    string_to_decimal(string_value)
    
    Exemple :
    decimal_value = string_to_decimal("Bonjour")      # decimal_value = "66 111 110 106 111 117 114"
    

  • Binary :

    string_to_binary(string_value)
    
    Exemple :
    binary_value = string_to_binary("Bonjour")      # binary_value = "01000010 01101111 01101110 01101010 01101111 01110101 01110010"
    

  • Hexadecimal :

    string_to_hexadecimal(string_value)
    
    Exemple :
    hexadecimal_value = string_to_hexadecimal("Bonjour")      # hexadecimal_value = "42 6F 6E 6A 6F 75 72"
    

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

bitconvertor-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

bitconvertor-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file bitconvertor-1.0.0.tar.gz.

File metadata

  • Download URL: bitconvertor-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bitconvertor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4cb3f09421ebd4536a18f51a40782118a46f1f6428914376ad8a4c1fc389d914
MD5 64a9bde4e7fc4a0b5e2aa9758edeb87f
BLAKE2b-256 d25f63f582098e9dbf81eccb640d8e50170da6eac1aa5ee4caf4f064e041e058

See more details on using hashes here.

File details

Details for the file bitconvertor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bitconvertor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bitconvertor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e893aac9dcf348ac78e65c182e5d7d6bcf3f2b5ffdde945a6f1d73e2adf95a41
MD5 b747e75d18a2e875a0fd28061ee64945
BLAKE2b-256 d09ee396451c02348e6b6309de6383b83866e99205badd2c25ec521472c9f8a2

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