gpt4 book ai didi

python - 统计字符串中长度为n(未给出)的子串出现x次

转载 作者:太空宇宙 更新时间:2023-11-04 10:12:28 25 4
gpt4 key购买 nike

<分区>

我无法获取字符串中长度为 n 的子字符串的出现次数。例如如果字符串是

CCCATGGTtaGGTaTGCCCGAGGT

n是

3

输出必须是这样的:

'CCC' : 2, 'GGT' :3

输入是列表的列表,所以我得到了列表的每个字符串,但我无法继续,输出是所有字符串的 dic

代码:

def get_all_n_repeats(n,sq_list):
reps={}
for i in sq_list:
if not i:
continue
else:
for j in i:
........#Here the code I want to do#......
return reps

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com