“Python String to hex” Réponses codées

chaîne à Hex Python

>>> s = 'The quick brown fox jumps over the lazy dog.'.encode('utf-8')
>>> s
b'The quick brown fox jumps over the lazy dog.'
>>> s.hex()
'54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f672e'
TalaatMagdy

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)
AlarmClockMan

Réponses similaires à “Python String to hex”

Questions similaires à “Python String to hex”

Plus de réponses similaires à “Python String to hex” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code