In Python, I want to extract only the characters from a string.
Consider I have the following string,
input = \"{(\'players\',): 24, (\'year\',): 28
What about doing this?
>>> import ast >>> " ".join([k[0] for k in ast.literal_eval("{('players',): 24, ('year',): 28, ('money',): 19, ('ipod',): 36, ('case',): 23, ('mini',): 46}").keys()]) 'case mini year money ipod players'