python split string into substrings of length code example
Example 1: split string by length python
>>> x = "qwertyui"
>>> chunks, chunk_size = len(x), len(x)/4
>>> [ x[i:i+chunk_size] for i in range(0, chunks, chunk_size) ]
['qw', 'er', 'ty', 'ui']
Example 2: python convert strings to chunks
s = '1234567890'
o = []
while s:
o.append(s[:2])
s = s[2:]