from string import ascii_letters, digits, whitespace
cyrillic_letters = u"абвгдеÑжзийклмнопÑÑÑÑÑÑ
ÑÑÑÑÑÑÑÑÑÑÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐРСТУФХЦЧШЩЪЫЬÐЮЯ"
def strip(text):
allowed_chars = cyrillic_letters + ascii_letters + digits + whitespace
print(allowed_chars)
return "".join([c for c in text if c in allowed_chars])
编辑:
不熟悉西里尔字母,但这是我如何设法去除字符,除了您指定的西里尔字母,拉丁字母,非数字和(我添加了这一个)从字符串空白。