Converting a deque object into list

穿精又带淫゛_ 提交于 2019-11-29 04:52:59

问题


currently I fetch "list" data from my storage, "deque" it to work with that data. After processing the fetched data I have to put them back into the storage. This won't be a problem as long as I am not forced (at least I think so) to use python's standard "list" object to save this data.

Storage Service: Google Appengine.

My work-around would be:

dequeObj = deque(myData)
my_list= list()
for obj in dequeObj:
    my_list.append(obj)

but this seems not very optimal.


回答1:


>>> list(collections.deque((1, 2, 3)))
[1, 2, 3]


来源:https://stackoverflow.com/questions/5773397/converting-a-deque-object-into-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!