A
A
Arbil2020-01-04 15:46:38
PHP
Arbil, 2020-01-04 15:46:38

Is there a function in Python that will display the number of elements?

Hello
In the title, I shortened the question a little, so the answer "len(foo)" will not help
. So, is there a built-in function in Python that can return how many times a certain element occurs in a list?
In order not to prescribe a cycle and not to import any modules.
Something like this

All_Elements = [1, 1, 5, 3, 2, 1]

function(All_Elements, 1) # 3

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
maksam07, 2019-03-10
@maksam07

https://github.com/paquettg/php-html-parser

I
Ivan, 2019-03-10
@vhuk1802

htmldomparser

A
artem78, 2019-03-10
@artem78

1) simplehtmldom
2) phpquery
2) for simple cases - regular expressions

R
Roman Kitaev, 2020-01-04
@Arbil

list.count

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question