fork download
  1. import unicodedata as ud
  2. text = "des поместья, de la famille Buonaparte. Non, je vous préviens que si vous"
  3. print(' '.join([word for word in text.split() if any('CYRILLIC' in ud.name(c) for c in word)]))
  4. # => поместья,
  5.  
  6. # If you also need to strip any punctuation:
  7. import string
  8. print(
  9. ' '.join([
  10. word.translate(str.maketrans('', '', string.punctuation))
  11. for word in text.split()
  12. if any('CYRILLIC' in ud.name(c) for c in word)
  13. ])
  14. )
  15. # => поместья
Success #stdin #stdout 0.02s 10004KB
stdin
Standard input is empty
stdout
поместья,
поместья