diviser une chaîne avec 2 char à 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]