dimanche 8 décembre 2019

Why my RegEx pattern in Unicode does not work?

import re
file = open('C:\item.bh.txt', 'r', encoding = 'utf-16')
pattern = re.findall(ur'[\u09ac][\u0995]', file)

It shows the following error:

File "", line 1

pattern = re.findall(ur'[\u09ac][\u0995]', file) ^

SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire