Remove Duplicate Characters

Remove duplicate characters from a string while keeping only the first occurrence of each character.

Code

General
''.join(dict.fromkeys(s))

Parameters

The string to remove duplicates from

Server

More Python Snippets