+2 votes
in Programming Languages by (11.2k points)
edited by

I have strings like this - Chashme Baddoor Full Songs ★ JUKEBOX ★ Ali Zafar, Divyendu Sharma, Siddharth. I want to remove all non-alphanumeric characters from it. How can I do it in python?

1 Answer

0 votes
by (11.2k points)

Best way is to use regular expression. Check this example.

import re

s ='Chashme Baddoor Full Songs ★ JUKEBOX ★ Ali Zafar, Divyendu Sharma, Siddharth'

s = re.sub('[^0-9a-zA-Z ]+', '', s)

...