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 :: dot product python 
Python :: openpyxl write in cell 
Python :: python square root 
Python :: how to iterate through a text file in python 
Python :: python change cmd title 
Python :: how to find location using latitude and longitude in python dataframe 
Python :: openpyxl get last non empty row 
Python :: MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory 
Python :: TypeError: sequence item 0: expected str instance, int found 
Python :: django sort queryset 
Python :: python datetime to utc 
Python :: convert two numpy array to pandas dataframe 
Python :: pandas string does not contain 
Python :: django create model from dictionary 
Python :: openpyxl delete column by name 
Python :: clock in python 
Python :: get max value column pandas 
Python :: pandas groupby count occurrences 
Python :: Installing python module from within code 
Python :: python link to jpg 
Python :: python range backward 
Python :: pandas to csv float format 
Python :: pandas conditional replace values in a series 
Python :: pandas replace column name from a dictionary 
Python :: django is null 
Python :: argparse list 
Python :: iqr in python 
Python :: sort value_counts output 
Python :: select all columns except one pandas 
Python :: django static media 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =