import string s = "А роза упала на лапу Азора" cs = list(filter( lambda x: x not in string.punctuation + string.whitespace, s)) print(cs) import re print(re.findall(r'[^\W_]', s))
Standard input is empty
['А', 'р', 'о', 'з', 'а', 'у', 'п', 'а', 'л', 'а', 'н', 'а', 'л', 'а', 'п', 'у', 'А', 'з', 'о', 'р', 'а'] ['А', 'р', 'о', 'з', 'а', 'у', 'п', 'а', 'л', 'а', 'н', 'а', 'л', 'а', 'п', 'у', 'А', 'з', 'о', 'р', 'а']