Разделите строку с 2 чар на Python
a_string = "abcde"
n = 2
split_strings = [a_string[index : index + n] for index in range(0, len(a_string), n)]
Nervous Nightingale
a_string = "abcde"
n = 2
split_strings = [a_string[index : index + n] for index in range(0, len(a_string), n)]
# Python3 - separate each character of non-spaced string
def split(string):
return [letter for letter in string]
# Driver code
string = 'split this string'
print(split(string))
def split(word):
return [char for char in word]