import re str тест def hex2dec return int 16 re findall map hex2dec fo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import re
s = str({1:'тест'})
def hex2dec(s):
return int(s[2:], 16)
a = re.findall(r'\\...', s)
b = map(hex2dec,a)
for i in zip(a,b):
s = s.replace(i[0], chr(i[1]))
f=open('C:\\temp\\news.txt','w')
f.write(s)
f.close()