How to construct a set out of list items in python?

前端 未结 6 1931
无人共我
无人共我 2020-11-27 12:25

I have a list of filenames in python and I would want to construct a set out of all the filenames.

filelist=[]
for filename in file         


        
6条回答
  •  一生所求
    2020-11-27 12:36

    One general way to construct set in iterative way like this:

    aset = {e for e in alist}
    

提交回复
热议问题