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?

4th May 2018, 8:19 AM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
2 ответов
+ 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)
4th May 2018, 8:30 AM
Ulisses Cruz
Ulisses Cruz - avatar
0
Thx!! :)
6th May 2018, 1:48 AM
Eduardo Perez Regin
Eduardo Perez Regin - avatar