Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python List count() Method
Description:
This method returns count of how many times obj occurs in list.
Syntax:
Parameters:
Here is the detail of parameters:
Return Value:
It returns count of how many times obj occurs in list.
Example:
#!/usr/bin/python
aList = [123, 'xyz', 'zara', 'abc', 123];
print "Count for 123 : ", aList.count(123);
print "Count for zara : ", aList.count('zara');
|
This will produce following result:
Count for 123 : 2
Count for zara : 1
|
|
|
|