python里面怎么改变unicode里面数值的内容,有啥函数吗
给你个例子:
x = b'\\u1234'
y = b'\\u1111'
xx = bytearray(x)
yy = bytearray(y)
print( xx, yy)
xx[2] = 97 #字符a的ascii
print(xx, xx.decode())
上面是改某个字节
x = b'\\u1234'
y = b'\\u1111'
xx , yy = x.decode(), y.decode()
res = int(xx[2:]) + int(yy[2:])
res = r"\u" + str(res)
print(res.encode())