python split word into letter pairs code example
Example 1: python split word into letter pairs
string = 'ABCDXY'
[string[i:i+2] for i in xrange(0, len(string), 2)]
Example 2: python split word into letter pairs
s = 'abcdef'
L = zip(s[::2], s[1::2])
# -> [('a', 'b'), ('c', 'd'), ('e', 'f')]