If order does not matter, you can use foo = "mppmt" "".join(set(foo)) set() will create a set of unique letters in the string, and "".join() will join the letters back to a string in arbitrary order. If order does matter,…
# 按字母表熟悉下string中的方法# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z# 标红的为常用重点的方法!! str = "tanGwei nI hao 你好 "###### A ################### 无###### B ################### 无###### C ##################print(str.count("a")) # 查找字符个数prin…