Lets say I have a string...
mystr = "abcdefghij"
I want to split it so that it becomes a list in groups of two like so...
mylist = ['ab', 'cd', 'ef', 'gh', 'ij']
I know there is a list()
method that will separate every character and a split()
method that will split on a designated character, but I can't figure out how to split it into groups where there is no whitespace or special character to split on.
Am I just missing something within those two methods, or is there a different way to do this?