天天看点

解决 python {JSONDecodeError}Invalid control character at: line 1 column 19644 (char 19643)

使用

`json.loads(res)` 
           

出现问题,

报错信息为:

{JSONDecodeError}Invalid control character at: line 1 column 19644 (char 19643)

代码修改为

代码成功运行

参数"strict=False"代表的含义:

If strict is false (True is the default), then control characters will be allowed inside strings. 
Control characters in this context are those with character codes in the 0–31 range, including '\t' (tab), '\n', '\r' and '\0'.

如果strict为false(默认值为True),则字符串中允许使用控制字符。此上下文中的控制字符是那些字符代码在0–31范围内的字符,包括“\t”(制表符)、“\n”、“r”和“\0”。