1
我有一些missunderstanding与编码正则表达式:simplejson - 编码正则表达式 d +
>>> simplejson.dumps({'title':r'\d+'})
'{"title": "\\\\d+"}'
>>> simplejson.loads('{"title": "\\\\d+"}')
{u'title': u'\\d+'}
>>> print simplejson.loads('{"title": "\\\\d+"}')['title']
\d+
所以,不使用print
我看到\\
,使用print
我看到\
。那么,什么值加载字典包含 - 与\\
或\
?
'r'''是原始字符串文字,不是正则表达式。这些文字在创建正则表达式时非常有用且有帮助,但它们完全是一个单独的概念。 –