二叉树好难。。。

class Solution:
    # 返回二维列表[[1,2],[4,5]]
    def Print(self, pRoot):
        # write code here
        if not pRoot:return []
        result = []
        mark = [pRoot]
        # 遍历每一层
        while mark:
            n = len(mark)
            ans = []
            # 遍历当前层每个结点
            for _ in range(n):
                node = mark[0]
                ans.append(node.val)
                mark.pop(0)
                if node.left :mark.append(node.left)
                if node.right :mark.append(node.right)
            result.append(ans)
        return result