s = 'just ***a*** /string/' a = list(s) for i in range(len(a)-1, 0, -1): if a[i] == '*' or a[i] == '/': a[i:i+1:] = [] print(a)print("".join(a))
Standard input is empty
['j', 'u', 's', 't', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g'] just a string
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!