Python converting from base64 to binary : <p>I have a problem about converting a base64 encoded string into binary. I am collecting the Fingerprint2D in the following link,</p>

<pre><code>url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/108770/property/Fingerprint2D/xml"

Fingerprint2D=AAADccB6OAAAAAAAAAAAAAAAAAAAAAAAAAA8WIEAAAAAAACxAAAAHgAACAAADAzBmAQwzoMABgCI AiTSSACCCAAhIAAAiAEMTMgMJibMsZuGeijn4BnI+YeQ0OMOKAACAgAKAABQAAQEABQAAAAAAAAA AA==
</code></pre>

<p>The descriptiong in the Pubchem says that this is 115 byte string, and it should be 920 bits when converted into binary. I try to convert it to the binary with the following,</p>

<pre><code>    response = requests.get(url)
    tree = ET.fromstring(response.text)

    for el in tree[0]:
        if "Fingerprint2D" in el.tag:
            fpp = bin(int(el.text, 16))
            print(len(fpp))
</code></pre>

<p>If I use the code above, I'm getting the following error, "Value error: invalid literal for int() with base16:</p>

<p>And if I use the code below, length of fpp (binary) is equal to 1278 which is not what I expected. </p>

<pre><code>    response = requests.get(url)
    tree = ET.fromstring(response.text)

    for el in tree[0]:
        if "Fingerprint2D" in el.tag:
            fpp = bin(int(hexlify(el.text), 16))
            print(len(fpp))
</code></pre>

<p>Thanks  a lot already!!</p>
