Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 lambda 来完成以下功能:
for i in range(0, len(testingList)): testingList[i] = testing[i][1:-1]
我不知道如何使用 lambda 来构建它。
非常感谢你。
为了使它适合lambda你必须使它成为一种表达方式。列表推导可以做到这一点:
lambda
somename = lambda tl: [elem[1:-1] for elem in tl]
调用它testingList:
testingList
testingList = somename(testingList)