Advertisement
oort77

words only

Feb 1st, 2022
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. regex = re.compile("[А-Яа-я:=!\)\()A-z\_\%/|]+")
  2. regex = re.compile("[А-Яа-яA-Za-z-]+")
  3.  
  4. def words_only(text, regex=regex):
  5.     try:
  6.         return " ".join(regex.findall(text))
  7.     except:
  8.         return ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement