def remove_duplicates(strng):
"""
Returns a string which is the same as the argument except only the
first occurrence of each letter is present. Upper and lower case
letters are treated as different. Only duplicate letters are removed,
other characters such as spaces or numbers are not changed.
>>> remove_duplicates('apple')
'aple'
>>> remove_duplicates('Mississippi')
'Misp'
>>> remove_duplicates('The quick brown fox jumps over the lazy dog')
'The quick brown fx jmps v t lazy dg'
>>> remove_duplicates('121 balloons 2 u')
'121 balons 2 u'
"""
s = strng.split()
return strng.replace(s[0],"")
중복 문자를 없애기 위해 함수를 작성하는 데는 한 시간이 걸렸으므로 아무 것도 얻을 수 없습니다. 덕분에 도움을 주실 수 있습니다.Python - 문자열에서 중복 제거
이 숙제처럼 보이는을 . 그렇다면 태그를 붙이십시오. –
주문이 중요하지 않은 경우 (그러나 그 것처럼 보이는 경우), "" ".join (set ("test "))'을 사용할 수 있습니다. – badp