s="abcabcabc"
S=list(s)
li=[]
l=[]
for i in S:
if i not in l:
l.append(i)
else:
li.append(l)
l=[]
l.append(i)
print(li)
输出是
[['a', 'b', 'c'], ['a', 'b', 'c']]
只得到两个子字符串而不是三个
我想要的输出是
[['a','b','c'],['a','b','c'],['a','b','c']]