Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to decode hexadecimal in python

hexstring = "4869"
a_string = bytes.fromhex(hexstring)
a_string = a_string.decode("ascii")
print(a_string)
Comment

how to encode hexadecimal python

>>> import binascii
>>> binascii.hexlify(b'Blaah')
b'426c616168'
Comment

hexadecimal with python

# int into hex
_hex = hex(42) # hexadecimal string

# hex into int
# you must specify base 16 as 2nd param as this tells python you're
# working with hexadecimal
int_hex = int(_hex, 16) # returns an integer
Comment

write hexadecimal in python

y=255
z=170
print(f'Hex Form: y={y:x} z={z:x} ')

#output
Hex Form: y=ff z=aa
Comment

PREVIOUS NEXT
Code Example
Python :: python env 
Python :: python 2 is no longer supported 
Python :: python curve fitting 
Python :: how to pass data between views django 
Python :: python inner join based on two columns 
Python :: copy string python 
Python :: change font size in plt 
Python :: change string list to int list python 
Python :: python ssh into server 
Python :: multiprocessing queue python 
Python :: python string to datetime object 
Python :: python dict append 
Python :: delete all elements in list python 
Python :: pandas describe kurtosis skewness 
Python :: python get file name without dir 
Python :: find max length in string in pandas dataframe 
Python :: python remove key from dict 
Python :: self-xss meaning 
Python :: calculate the same value in list i python 
Python :: how to import turtle in python 
Python :: python drop all variable that start with the same name 
Python :: list comprehension python if 
Python :: Sum values of column based on the unique values of another column 
Python :: get month day year 12 hour time format python 
Python :: ImportError: dynamic module does not define module export function 
Python :: python print show special characters 
Python :: loss funfction suited for softmax 
Python :: 1d array to one hot 
Python :: python list splicing 
Python :: how to make a random variable in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =