Converting to binary in MATLAB and Python

Converting to binary in MATLAB and Python

I have some Matlab code that I am trying to convert to Python.
In Matlab the code takes a string and converts it to a double, then to
binary.
x = dec2bin(double(string), 8);
Now, the string has numbers, letters, decimal points, and commas. Matlab
has no problems converting this.
Is there anything in Python that can do this?
I've tried using bin(), changing the string to a float first, various
Numpy options like:
x = numpy.base_repr(string, 2, 8)
and
numpy.binary_repr()