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

alex23 wuwei23 at gmail.com
Tue Oct 27 04:37:06 EDT 2009


Gerard Flanagan <grflana... at gmail.com> 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