+ 1

How can i remove all non-alphabetical characters from a list or a string in Python

I've already created a variable and assigned it the uppercase and lowercase letters

24th Jul 2020, 10:57 PM
Aloys Aboge Jr
Aloys Aboge Jr - avatar
2 Answers
+ 6
You could also do something like this: string = '96rrdfphc9(/$jgdr' print(''.join([i for i in string if i.isalpha()]))
24th Jul 2020, 11:43 PM
Rik Wittkopp
Rik Wittkopp - avatar