In Python, I want to extract only the characters from a string.
Consider I have the following string,
input = \"{(\'players\',): 24, (\'year\',): 28
import re
string = ''.join([i for i in re.findall('[\w +/.]', string) if i.isalpha()])
#'[\w +/.]' -> it will give characters numbers and punctuation, then 'if i.isalpha()' this condition will only get alphabets out of it and then join list to get expected result.
# It will remove spaces also.