How to find the characters that a string consists of in Python

1 Answer

0 votes
string = "Python is a general-purpose programming language"

unique_chars = set(string)

print(unique_chars)




'''
run:

{'r', 'g', 'P', 'u', 'n', 's', 'a', 'l', ' ', 'y', 'p', 'o', 'e', 'i', 'h', 'm', 't', '-'}

'''

 



answered Nov 24, 2024 by avibootz

Related questions

1 answer 118 views
1 answer 100 views
1 answer 106 views
1 answer 103 views
1 answer 107 views
...