1. 程式人生 > >獲取字符串中重復字符的索引

獲取字符串中重復字符的索引

int div abc 獲取字符串 app code end find while

list_all=[]
oper_s="abcdaaaa"
i_num=0
while(True):
    x=oper_s.find("a",i_num)
    print(x)
    
    if(not x==-1):
        i_num=x+1
        list_all.append(x)
    else:
        break
print(list_all)

獲取字符串中重復字符的索引