获取字符串中重复字符的索引

 

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)

 

posted @ 2019-03-07 23:04  anobscureretreat  阅读(644)  评论(0编辑  收藏  举报