[Python-ideas] string method count()

João Santos jmcs at jsantos.eu
Wed Apr 25 14:31:49 EDT 2018


Hi,

>From https://docs.python.org/3/library/stdtypes.html#str.count:
str.count(*sub*[, *start*[, *end*]])

Return the number of *non-overlapping* occurrences of substring *sub* in
the range [*start*, *end*]. Optional arguments *start* and *end* are
interpreted as in slice notation.
Best regards,
João Santos

On Wed, 25 Apr 2018 at 20:22 Julia Kim <julia.hiyeon.kim at gmail.com> wrote:

> Hi,
>
> There’s an error with the string method count().
>
> x = ‘AAA’
> y = ‘AA’
> print(x.count(y))
>
> The output is 1, instead of 2.
>
>
> I write programs on SoloLearn mobile app.
>
>
>
> Warm regards,
> Julia Kim
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180425/97106720/attachment.html>


More information about the Python-ideas mailing list