📜  如何计算列表中的东西python代码示例

📅  最后修改于: 2022-03-11 14:45:34.150000             🧑  作者: Mango

代码示例1
list.count(element)

list1 = ['red', 'green', 'blue', 'orange', 'green', 'gray', 'green']
color_count = list1.count('green')
print('The count of color: green is ', color_count)