【发布时间】:2015-11-15 14:29:31
【问题描述】:
我有一个由经理列表组成的数组,例如:
[<ListProxy object, typeid 'list' at 0x177d350>, <ListProxy object, typeid 'list' at 0x177d390>, ...]
并尝试将其转换为纯列表。我的考虑如下:
y=[]
for i in my_manager_list_content:
for j in i:
y.append(float(j))
print y #This works
print [next(iter(i[:])) for i in my_manager_list_content] #Why doesn't this work?
我怎么能在 oneliner 中做到这一点?
【问题讨论】:
-
[float(i) for j in my_manager_list_content for i in j]? -
谢谢。这就是解决方案!
标签: python python-multiprocessing