Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python convert hex to binary

my_hexdata = "1a"

scale = 16 # equal to hexadecimal

bin(int(my_hexdata, scale))[2:].zfill(len(my_hexdata)*4)
# By changing the parameter of the zfill function we allow for any length of
# hexadecimal code, which is more useful when using this code.
Comment

hex to binary python3

my_hexdata = "1a"

scale = 16 ## equals to hexadecimal

num_of_bits = 8

bin(int(my_hexdata, scale))[2:].zfill(num_of_bits)
Comment

PREVIOUS NEXT
Code Example
Python :: python get latest edited file from any directory 
Python :: how to use a string variable as a variable name in python 
Python :: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable 
Python :: python ssl module is not available 
Python :: returns the smallest positive integer python 
Python :: pandas duplicated rows count 
Python :: Replace the string with NAN value 
Python :: get all file in folder python 
Python :: what does class meta do in django 
Python :: create and populate dictionary python 
Python :: tkinter button position 
Python :: matplotlib cheatsheet 
Python :: np arange shape 
Python :: change column name pandas 
Python :: extract pdf with python 
Python :: how to resize windows in python 
Python :: wget command python 
Python :: pip install for python 2 and python3 
Python :: df col to dict 
Python :: list directory in python 
Python :: how to add vertical line on subplot in matplotlib 
Python :: how to find 1 st digit in python 
Python :: PIL image example 
Python :: pandas count unique values in column 
Python :: how to make django model field case insensitive 
Python :: spawn shell using python 
Python :: python split string every character 
Python :: scikit image 0.16.2 
Python :: what is hashlib in python 
Python :: django fixtures. To dump data 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =