关于 Python 如何处理 json 数据转义的问题
def tamper(payload,**kwargs): line = payload.encode(‘hex’) n=2 groups = [line[i:i+n] for i in range(0,len(line),n)] full = ” for x in groups: full = full + ‘u00’ +x retVal = full return retVal
我有一段 python 程序,运行环境是 linux,python2 想要把我的数据 转成u00xx 这样的 json 能解析的数据然后发包请求,但是在实际过程中出现报错
‘unicodeescape’ codec can’t decode bytes in position 0-3: truncated uXXXX escape 然后我将 ‘u00’更改为 r’u00’之后报另一个错误 LookupError: ‘hex’ is not a text encoding; use codecs.encode() to handle arbitrary codecs’” 应该怎么解决有表哥吗