Discuss / Python / 用lambda试试

用lambda试试

Topic source

swunstudent

#1 Created at ... [Delete] [Delete and Lock User]

第一个

L1 = ['aa','bbb']

L2 = list(map(lambda s: s.title(), L1))

print(L2)
['Aa', 'Bbb']

第二个:

def prod(L):
    return reduce(lambda x,y: x*y, L)

  • 1

Reply