I\'ve created a method to convert an int to a bitfield (in a list) and it works, but I\'m sure there is more elegant solution- I\'ve just been staring at it for to
int
Does not work for negative values
>>> import numpy as np >>> [int(x) for x in np.binary_repr(123)] [1, 1, 1, 1, 0, 1, 1]