📜  集合中的 python 字符串 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:12.576000             🧑  作者: Mango

代码示例1
a_string = 'Hello World Hello'

# In case we want to get a 'set' of chars
print(set(a_string))
# Output -> {'W', 'r', 'l', 'H', 'd', ' ', 'o', 'e'}

# In case we want to get a 'set' of words
print(set(a_string.split()))
# Output -> {'Hello', 'World'}