There’s an string like this:
abcdefghijk
I want to slice it like this:
abc
bcd
cde
def
efg
fgh
ghi
hij
ijk
I googled but could not find any site or answers to reach this.
Update 1
My question is not similar to Split string every nth character?.
>Solution :
s = "abcdefghijk"
str_list = []
for i in range(len(s)-2):
new_string = s[i] + s[i+1] + s[i+2]
str_list.append(new_string)
for x in str_list:
print(x)