代碼如下:
a=[]
x?=?[]
for?i?in?range(0,len(c)):
if?i?+?1?<?len(c):
if?c[i]?==?c[i?+?1]:
x.append(c[i])
else:
a.append(x)
x.append(c[len(c)?-?1])
print(a)
運行結果: