On 31 Gen, 17:30, "TOXiC" <[EMAIL PROTECTED]> wrote:
> It wont work with utf-8,iso or ascii...
I think the best way is to search hex value in the file stream but I
tryed (in the regex) \hxx but it don't work...
--
http://mail.python.org/mailman/listinfo/python-list
It wont work with utf-8,iso or ascii...
--
http://mail.python.org/mailman/listinfo/python-list
TOXiC wrote:
> Thx it work perfectly.
> If I want to query a file stream?
>
> file = open(fileName, "r")
> text = file.read()
> file.close()
Convert the bytes read from the file to unicode. For that you have to know
the encoding, e. g.
file_encoding = "utf-8" # replace with th
Thx it work perfectly.
If I want to query a file stream?
file = open(fileName, "r")
text = file.read()
file.close()
regex = re.compile(u"(ÿÿ‹ð…öÂ)", re.IGNORECASE)
match = regex.search(text)
if (match):
result = match.group()
print result
WritePatch
TOXiC wrote:
> How I can do a regex match in a string with ascii and non ascii chars
> for example:
>
> regex = re.compile(r"(ÿÿ?ð?öÂty)", re.IGNORECASE)
> match = regex.search("ÿÿ?ð?öÂty")
> if match:
> result = match.group()
> print result
> else:
> resul
Hello everybody.
How I can do a regex match in a string with ascii and non ascii chars
for example:
regex = re.compile(r"(ÿÿ‹ð…öÂty)", re.IGNORECASE)
match = regex.search("ÿÿ‹ð…öÂty")
if match:
result = match.group()
print result
else:
result = "No match fou