匿名函数问题
li = [lambda : x for l in range(10)] print(li)
打印出来如下
[<function <listcomp>.<lambda> at 0x000002B9EDE508C8>, <function <listcomp>.<lambda> at 0x000002B9EDE50B70>, <function <listcomp>.<lambda> at 0x000002B9EDE81F28>, <function <listcomp>.<lambda> at 0x000002B9EDE99048>, <function <listcomp>.<lambda> at 0x000002B9EDE990D0>, <function <listcomp>.<lambda> at 0x000002B9EDE99158>, <function <listcomp>.<lambda> at 0x000002B9EDE991E0>, <function <listcomp>.<lambda> at 0x000002B9EDE99268>, <function <listcomp>.<lambda> at 0x000002B9EDE992F0>, <function <listcomp>.<lambda> at 0x000002B9EDE99378>]
Process finished with exit code 0
3.7环境下