خرید بک لینک

Vote count: 0

I have a string:

seq = '01234567890123456789'

that I want to first break up into intervals of 4. I found a previous answer

n = 4    
[seq[i:i+n] for i in range(0,len(seq,n)]

which gives me

['0123', '4567', '8901', '2345', '6789']

And now I want to compare my chunked up string to every entry in a list of substrings:

mylist = ['0123', '1111' '2345']

and retu an array that counts how many times each substring appeared in the original string. I see a lot of examples of finding one substring in a larger string but I'm confused as to how to do this with a list of substrings

asked 57 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 18 خرداد 1395 ساعت: 21:43

صفحه بندی