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

2009-10-27 Thread Gerard Flanagan
alex23 wrote: Gerard Flanagan grflana...@gmail.com wrote: def count(text, *args): Other than the ability to handle multiple substrings, you do realise you've effectively duplicated str.count()? I realise that calling this count function with a single argument would be functionally

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

2009-10-27 Thread Gabriel Genellina
En Tue, 27 Oct 2009 04:31:22 -0300, Gerard Flanagan grflana...@gmail.com escribió: alex23 wrote: Gerard Flanagan grflana...@gmail.com wrote: def count(text, *args): Other than the ability to handle multiple substrings, you do realise you've effectively duplicated str.count()? I realise

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

2009-10-27 Thread alex23
Gerard Flanagan grflana...@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

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

2009-10-26 Thread Gerard Flanagan
Peng Yu wrote: For example, the long string is 'abcabc' and the given string is 'abc', then 'abc' appears 2 times in 'abcabc'. Currently, I am calling 'find()' multiple times to figure out how many times a given string appears in a long string. I'm wondering if there is a function in python

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

2009-10-26 Thread alex23
Gerard Flanagan grflana...@gmail.com wrote: def count(text, *args): Other than the ability to handle multiple substrings, you do realise you've effectively duplicated str.count()? -- http://mail.python.org/mailman/listinfo/python-list

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

2009-10-23 Thread Peng Yu
For example, the long string is 'abcabc' and the given string is 'abc', then 'abc' appears 2 times in 'abcabc'. Currently, I am calling 'find()' multiple times to figure out how many times a given string appears in a long string. I'm wondering if there is a function in python which can directly

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

2009-10-23 Thread Stephen Hansen
On Fri, Oct 23, 2009 at 7:31 PM, Peng Yu pengyu...@gmail.com wrote: For example, the long string is 'abcabc' and the given string is 'abc', then 'abc' appears 2 times in 'abcabc'. Currently, I am calling 'find()' multiple times to figure out how many times a given string appears in a long

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

2009-10-23 Thread Erik Max Francis
Peng Yu wrote: For example, the long string is 'abcabc' and the given string is 'abc', then 'abc' appears 2 times in 'abcabc'. Currently, I am calling 'find()' multiple times to figure out how many times a given string appears in a long string. I'm wondering if there is a function in python