Count elements in a list python

前端 未结 6 1427
有刺的猬
有刺的猬 2021-01-26 14:14

I need to be able to count how many of the string \"O\" is in my list

top_board = [
    [None, None, None, None, None, None, None, None, None],
    [None, None,         


        
6条回答
  •  无人共我
    2021-01-26 14:38

    if [j for i in top_board for j in i].count('O'):
        print "O is present in the list"
    

提交回复
热议问题