On this page
  1. operator.countOf
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

operator.countOf

Prev: operator.contains | Up: operator | Next: operator.delitem
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.countOf
Tags: #public #python3 #stdlib #operator


Import

import operator
from operator import countOf

Signature & Overview

operator.countOf(a, b, /)

Return the number of items in a which are, or which equal, b.

Usage

import operator

assert operator.countOf([1, 2, 1, 3, 1], 1) == 3

Gotchas

REPL Inspect

from operator import countOf
help(countOf)

Linked from

Related notes