感觉写了一座💩💩💩💩屎山💩💩💩💩,供大家观摩留念。。。 代码核心思想是BFS遍历,使用{}作为不同节点的分割(节点可能出现10这样的两个字符的数据。) 然后一堆判断。 咦。。。好恶心🤮🤮🤮🤮🤮 # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def Serialize(self, root): if root == None: return "" ...