0
Get each character python
I have a string: "this is my string" I want to obtain each character of the string and remove the repeated charecters. Any idea about how to do it?
2 Antworten
+ 4
hello Eduardo Perez Regin
try this:
# if you don't need to keep the character order do this
my_string = set('this is my string')
# if the order is needed do
caracters = []
for c in my_string:
if c not in caracters:
caracters.append(c)
0
Thx!! :)