Inserting newline character after every 76 characters in a base64 string
base64, python
Solution
'\n'.join(s[pos:pos+76] for pos in xrange(0, len(s), 76))
Problem
I am trying to convert bitmap images into a base64 string before inserting it into database as binary blobs. The base64 string needs to be encoded in such a way that their is a new line character after every 76 characters. What is the best pythonic way of doing this?