Answers for "convert binary to hex python"

2

python convert binary / hexadecimal / decimal to binary / hexadecimal / decimal

## First install the module coden with pip in cmd
# pip install coden

## import module
import coden

## Convert

# Binary to Decimal
ans = coden.bin_to_int(number)
# Binary to Hexadecimal
ans = coden.bin_to_hex(number)

# Hexadecimal to Decimal
ans = coden.hex_to_int(number)
# Hexadecimal to Binary
ans = coden.hex_to_bin(number)

# Decimal to Binary
ans = coden.int_to_bin(number)
# Decimal to Hexadecimal
ans = coden.int_to_hex(number)


# Thank you!
Posted by: Guest on February-08-2021
0

binary string to hex python

binary_string = input('Input Binary: ')

decimal_representation = int(binary_string, 2)
hexadecimal_string = hex(decimal_representation)

print(hexadecimal_string)
Posted by: Guest on June-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language