Martin Panter added the comment:
I wrote an incremental base-64 decoder for the "codecs" module in Issue 27799,
which you could use. It just does some preprocessing using a regular expression
to pick four-character chunks before passing the data to a2b_base64. Or maybe
implementing it properl
R. David Murray added the comment:
This reduces to the following:
>>> from binascii import a2b_base64 as f
>>> f(b'MTIzND\nU2Nzg5\n')
b'123456789'
>>> f(b'MTIzND\n')
Traceback (most recent call last):
File "", line 1, in
binascii.Error: Incorrect padding
That is, decode does its decoding li
New submission from Gregory P. Smith :
I've tried reading various RFCs around Base64 encoding, but I couldn't make the
ends meet. Yet there is an inconsistency between base64.decodebytes() and
base64.decode() in that how they handle linebreaks that were used to collate
the encoded text. Belo