Possible Duplicate:
How do you split a list into evenly sized chunks in Python?
What is the most “pythonic” way to iterate over a list in chunks?
Say I have a string
s = '1234567890ABCDEF'
How can I slice (or maybe split is the correct term?) this string into a list consisting of strings containing 2 characters each?
desired_result = ['12', '34', '56', '78', '90', 'AB', 'CD', 'EF']
Not sure if this is relevant, but I'm parsing a string of hex characters and the final result I need is a list of bytes, created from the list above (for instance, by using int(desired_result[i], 16)
)