Is there any neat trick to slice a binary number into groups of five digits in python?
\'00010100011011101101110100010111\' => [\'00010\', \'00110\', \'10111\', ... ]
>>> l = '00010100011011101101110100010111' >>> def splitSize(s, size): ... return [''.join(x) for x in zip(*[list(s[t::size]) for t in range(size)])] ... >>> splitSize(l, 5) ['00010', '10001', '10111', '01101', '11010', '00101'] >>>