python - How can I use lambda complete this function? -
i want use lambda finish following function:
for in range(0, len(testinglist)): testinglist[i] = testing[i][1:-1]
i don't know how use lambda build it.
thank much.
to make fit in lambda
you'd have make 1 expression. list comprehension can that:
somename = lambda tl: [elem[1:-1] elem in tl]
call testinglist
:
testinglist = somename(testinglist)
Comments
Post a Comment