【发布时间】:2017-02-26 05:42:24
【问题描述】:
def nest(x, n):
a = []
for i in range(n):
a.append([x])
return a
print nest("hello", 5)
这给出了一个输出
[['hello'], ['hello'], ['hello'], ['hello'], ['hello']]
想要的输出是
[[[[["hello"]]]]]
【问题讨论】:
标签: python list python-2.7 nested