按照crossin的说法
使用map函数可以直接输出列表
>>> list1 = [ 0, 1, 2, 3, 4, 5, 6 ]
>>> list2 = map(lambda x:x*2,l1)
>>> print(list2)
[0,2,4,6,8,10,12]
但应用于python3
输出的结果并非如此,而是这样的:
<
map
object
at
0x00000000021DA860
>
所以要使用map函数
必须要这样写:
lst_1=[1,2,3,4,5,6]
lst_2=map(lambda x:x*2,lst_1)
print(list(lst_2)