"John" <weekender_ny at yahoo.com> writes: > if S1 = "AAAA" > and S2 = "AA" > > then the count is 3. Is there an easy way to do this in python? > I was trying to use the "count" function but it does not do > overlapping counts it seems. len([1 for i in xrange(len(s1)) if s1[i:].startswith(s2)])