Use filter in bfs
class Solution(object):
def findBottomLeftValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
queue = [root]
while any(queue):
top = queue.pop(0)
queue += filter(None, (top.left, top.right))
return