我所说的“递归”是这样的:[["hello", world, [1, 2, 3]], ["foo"]]
。如何将4附加到[1, 2, 3]
列表中
我有一门课:
class RabbitHole:
def __init__(self, new_name, new_holes):
self.name = new_name
self.holes = new_holes
(holes
是RabbitHole
对象的列表。)
我想附加到具有“路径”(父孔的名称)的孔hat
。我如何在保留整个“目录树”的同时更改/附加某些内容到帽子洞中(我在go中做过类似的事情,但在python中我不知道如何做)
假设每个示例都有一个多维列表,则可以执行以下操作:
这将产生:
相关问题 更多 >
编程相关推荐