I am new in python and I have a text file with the following content
ss ss1, ss ss2, ss ss3, ss ss2, ss ss2, ss ss3
I want to delete the duplicate Words. My expected output is following
ss ss1, ss ss2, ss ss3
I am using the below code
f = open('a.txt', 'r')
file_contents = f.read()
words = file_contents.split()
SS=",".join(sorted(set(words), key=words.index))
print SS
My current output is
ss,ss1,,ss2,,ss3,,ss2