Tag Archives: set

Python: removing repeated values in a list

PLAIN TEXT CODE: list = ['one', 'two', 'three', 'one', 'one', 'four', 'two'] #convert the list into a set.  An element can only exist once within a set set = set(list) #convert the set back into a list type list = list(set) print list Are those variable names confusing? Let's look at that example again: PLAIN [...]