这是一个创建于 3012 天前的主题,其中的信息可能已经有所发展或是发生改变。
s = """{'message': " AwContents.java:599:30: ',' is not followed by whitespace.\n android", 'a': 'tango'"""
1.直接 json.loads(s),报错 json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2.替换引号 s = s.replace("'", '"'),报错 json.decoder.JSONDecodeError: Invalid control character at: line 1 column 74 (char 73)
各位这个要怎么处理啊?因为这个要在 server 端用,不能使用 eval()
3 条回复 2018-01-26 13:23:58 +08:00  | | 1 jackyzy823 2018 年 1 月 26 日 ast.literal_eval 可行否 以及 s 的 tango 后面少了个} |