标签:推导 ict class dict lam 高级 return start lambda
1. labels = list(map(lambda t: [label_dict[‘<start>‘]] + list(t), labels))
1 labels = list(map(lambda t: [label_dict[‘<start>‘]] + list(t), labels)) 2 3 # lambda t: [label_dict[‘<start>‘]]+list(t) 4 def func(t, label_dict): 5 return [label_dict[‘<start>‘]]+list(t) 6 # labels = list(map(, labels)) 7 labels = [func(e, label_dict) for e in labels] 8 9 # list(map由于Python3的限定,不如列表推导,要少用。 10 # list(map(func, labels))=>[func(ele) for ele in labels]
标签:推导 ict class dict lam 高级 return start lambda
原文地址:http://www.cnblogs.com/Joyce-song94/p/7806295.html