小编use*_*981的帖子

使用列表推导从2 ^ 0到2 ^ 99找到2的幂

def lst_comp():
    list = []
    list = (2**i for i in range(100))
    print list
    return list
Run Code Online (Sandbox Code Playgroud)

我这样做时得到这个: <generator object <genexpr> at 0x00000000034C48B8>

python list-comprehension python-2.7

-2
推荐指数
1
解决办法
112
查看次数

标签 统计

list-comprehension ×1

python ×1

python-2.7 ×1