python - How to remove duplicates in strings within list? -
i have list of string in each string duplicate need remove. f.e.:
lst = ('word1 2 36 2 2' ' word2 96 5 5 5 14' 'word3 45 6 45 45')
etc.
i need:
lst = ('word1 2 36' 'word2 96 5 14' 'word3 45 6')
generally:
- create
dictionary
each key wordn - in key, convert item 2 through n of
list
set
- iterate through dictionary, building new list each key , set's contents
Comments
Post a Comment