Is there a command that returns the number of substrings in a string?

alex23 wuwei23 at
Tue Oct 27 09:37:06 CET 2009

Gerard Flanagan <grflana... at> wrote:
> I realise that calling this count function with a single argument would
> be functionally identical to calling str.count(), yes. But I can imagine
> the situation of wanting to find multiple (disjoint) substrings. Is
> there a reason for preferring multiple calls to str.count() in such a
> case? Or is there a more obvious approach?

No, I totally missed that it was counting disjoint substrings :)

More information about the Python-list mailing list