string1 = "calvin klein design dress calvin klein"
words = string1.split()
print (" ".join(sorted(set(words), key=words.index)))
This sorts the set of all the (unique) words in your string by the word’s index in the original list of words.
Related Contents:
- How do I check if there are duplicates in a flat list?
- Convert hex string to integer in Python
- How would you make a comma-separated string from a list of strings?
- How to extract numbers from a string in Python?
- String comparison in Python: is vs. == [duplicate]
- How to delete a character from a string using Python
- Changing one character in a string
- Find index of last occurrence of a substring in a string
- Remove pandas rows with duplicate indices
- How to convert ‘binary string’ to normal string in Python3?
- Count number of occurrences of a substring in a string
- How do I remove leading whitespace in Python?
- Split a string by a delimiter in python
- How to test if a string contains one of the substrings in a list, in pandas?
- Removing numbers from string [closed]
- String to Dictionary in Python [duplicate]
- How do you check in python whether a string contains only numbers?
- How to print like printf in Python3?
- Finding a substring within a list in Python [duplicate]
- Process escape sequences in a string in Python
- Convert hex to binary
- Python, add trailing slash to directory string, os independently
- String concatenation of two pandas columns
- How do I get rid of the b-prefix in a string in python?
- How can I copy a Python string?
- How to generate random strings in Python?
- Most pythonic way to interleave two strings
- Get last “column” after .str.split() operation on column in pandas DataFrame
- How to “properly” print a list?
- String concatenation vs. string substitution in Python
- How do I convert a Python UUID into a string?
- How do I verify that a string only contains letters, numbers, underscores and dashes? [duplicate]
- Remove Sub String by using Python
- Does R have function startswith or endswith like python? [closed]
- How do I concatenate a boolean to a string in Python?
- Add commas into number string [duplicate]
- lower() vs. casefold() in string matching and converting to lowercase
- Python: is using “..%(var)s..” % locals() a good practice?
- Python copy files to a new directory and rename if file name already exists
- Duplicate each member in a list [duplicate]
- How to install python package with a different name using PIP
- What does = (equal) do in f-strings inside the expression curly brackets?
- Pandas Extract Number from String
- Converting int arrays to string arrays in numpy without truncation
- Removing list of words from a string
- TypeError: sequence item 0: expected str instance, bytes found
- Column of lists, convert list to string as a new column
- How To Get All The Contiguous Substrings Of A String In Python?
- Find longest repetitive sequence in a string
- Python 3 string to hex