Input:
list=["@stellar I loo#oo)oooovvvv;vveee my K!" , "rl I loo#os#"]
I want like this output:
"stellar I loooooooovvvvvveee my K", "rl I looos"
How can i delete some ascii characters in list? ( not only #,!,@,) )
Input:
list=["@stellar I loo#oo)oooovvvv;vveee my K!" , "rl I loo#os#"]
I want like this output:
"stellar I loooooooovvvvvveee my K", "rl I looos"
How can i delete some ascii characters in list? ( not only #,!,@,) )
 
    
    You can use regex:
import re
regex = re.compile('[^a-zA-Z\ ]')
my_strings = =["@stellar I loo#oo)oooovvvv;vveee my K!" , "rl I loo#os#"]
print([regex.sub("", s) for s in my_strings])
>>> ['stellar I loooooooovvvvvveee my K', 'rl I looos']
This will replace all non-letter characters by an empty string (therefore deleting it)
You can use re.compile('[^0-9a-zA-Z\ ]') if you want to keep numbers
 
    
    You can map that list, with regex replace.
import re
list=["@stellar I loo#oo)oooovvvv;vveee my K!" , "rl I loo#os#"]
result = list(map(lambda x: re.sub('[^A-Za-z0-9\s]', '', x), list))
print(result)
 
    
    see below:
my_list=["@stellar I loo#oo)oooovvvv;vveee my K!" , "rl I loo#os#"]
chars_to_remove = ['!','@']
for word in my_list:
    for char in word:
        if char in chars_to_remove:
            word.replace(char, '')
