Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert unicode escape sequence

import re

unconverted_str = "abcdefg32qwerty"
#see how python interprets you string, should be like "aaaxxxbbb"
print(unconverted_str)
converted_str = ""

reg = re.findall("\[0-9].{2}", unconverted_str)
char_esc_sqc = [chr(int(elem[2:])) for elem in reg]
for char in char_esc_sqc:
    converted_str = re.sub("\[0-9].{2}", char, unconverted_str, 1)

print(converted_str)
 
PREVIOUS NEXT
Tagged: #python #convert #unicode #escape #sequence
ADD COMMENT
Topic
Name
7+6 =