def find_str_position(m_str, c_str): mlen = len(m_str) clen = len(c_str) position_list = [] for i in range(mlen): if i+clen <= mlen: tmp_str = '' for j in range(clen): tmp_str += m_str[i+j] if tmp_str == c_str: position_list.append(i) return position_list print(find_str_position('aabbcc', 'bb'))
# 找到字符串的位置分布
猜你喜欢
转载自blog.csdn.net/m0_37711659/article/details/88555621
今日推荐
周排行