我对Unicode字符串做了一些研究,但不幸的是,我无法理解Python为什么会做一些事情
我有一段代码:
output["anything"] = {
"type": "Feature",
"properties": {
"name": "somename",
"amenity": "Store",
"popupContent": "Store 3 "
},
}
当我使用print(output)
时,它将此打印为:
{u'anything': u'type': u'Feature', u'properties': {u'amenity': u'Store', u'name': u'somename', u'popupContent': u'Store 3'}}
但是,我希望在没有u' '
的情况下使用它,因为我的javascript实用程序不会读取它
您应该使用
json.dumps
而不是打印输出:
相关问题 更多 >
编程相关推荐