I have a list of filenames in python and I would want to construct a set out of all the filenames.
list
set
filelist=[] for filename in file
Here is another solution:
>>>list1=["C:\\","D:\\","E:\\","C:\\"] >>>set1=set(list1) >>>set1 set(['E:\\', 'D:\\', 'C:\\'])
In this code I have used the set method in order to turn it into a set and then it removed all duplicate values from the list