In [8]:
hexdata = "fff39ced"
In [11]:
scale = 16 ## equals to hexadecimal
num_of_bits = 32
In [13]:
bindata = bin(int(hexdata, scale))[2:].zfill(num_of_bits)
In [14]:
bindata
Out[14]:
In [15]:
len(bindata)
Out[15]:
In [18]:
type(bindata)
Out[18]:
In [7]:
decdata = "728"
In [8]:
scale = 10
num_of_bits = 32
In [9]:
bindata = bin(int(decdata, scale))[2:]
#.zfill(num_of_bits)
In [10]:
bindata
Out[10]:
In [11]:
int(bindata)
Out[11]:
In [12]:
bindata[0]
Out[12]:
In [13]:
int(bindata[0])
Out[13]:
In [14]:
import numpy as np
In [15]:
bindataarray = np.array([[int(e) for e in bindata]])
In [21]:
bindataarray
Out[21]:
In [20]:
bindataarray[:,5:7] = np.array([7,6])
In [22]:
range(5,16)
Out[22]:
In [ ]: