python 单引号与双引号的转义

import simplejson

a = """{"a":"\\""}"""
b = """{"a":"\\'"}"""
print simplejson.loads(a)
print simplejson.loads(b)

输出:
{'a': '"'}
simplejson.errors.JSONDecodeError: Invalid \X escape sequence '\\': line 1 column 7 (char 6)
posted @ 2019-08-30 12:37  huim  阅读(5306)  评论(0编辑  收藏  举报