I'm want to remove the chinese characters of a text or any other any character that isnt Latin
i tried using encoding='UTF-8' but dont works
Text Example: Um olhar maligno que só desejava a destruição! “Parem-o!” Ele ordenou os demônios. Os demônios abriram suas asas, seguraram suas armas e lançaram magia. Σ? ?Γαπ? ……. ” Γει? !!
I want that return Um olhar maligno que só desejava a destruição! “Parem-o!” Ele ordenou os demônios. Os demônios abriram suas asas, seguraram suas armas e lançaram magia. ? ?? ……. ” ? !!
Try this, is this what you wanted?
test = "Um olhar maligno que só desejava a destruição! “Parem-o!” Ele ordenou os demônios. Os demônios abriram suas asas, seguraram suas armas e lançaram magia. Σ? ?Γαπ? ……. ” Γει? !!"
import re
regex = re.compile('[^\u0020-\u024F]')
#First parameter is the replacement, second parameter is your input string
regex.sub('', test)
Try to use this extension of Latin encoding:
ISO 8859-2 (Latin 2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.