Answers for "how to convert to hex python"

5

python string to hex

hex_string = "0xAA"
# "0x" also required

an_integer = int(hex_string, 16)
# an_integer is a decimal value

hex_value = hex(an_integer)
print(hex_value)
Posted by: Guest on July-14-2020
0

python rgb to hex

# Convert RGB to HEX
rgb = (255,255,255) # ---------> pure white
print("#%02x%02x%02x" % rgb) # -----> #ffffff

#													- sabz
Posted by: Guest on July-14-2021

Code answers related to "how to convert to hex python"

Python Answers by Framework

Browse Popular Code Answers by Language