且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python:查询字典到 JSON

更新时间:2022-11-26 13:54:50

QueryDict 类是子类常规 Python 字典,除了它处理同一个键的多个值(参见 code>MultiValueDict 实现).

QueryDict class is a subclass of regular Python dictionary, except that it handles multiple values for a same key (see MultiValueDict implementation).

如果你想把它转储到一个字符串,只需使用json.dumps():

If you want to dump it to a string, just use json.dumps():

json.dumps(my_query_dict) 

还有一个相关的dict() 方法:

There is also a relevant dict() method:

QueryDict.dict()

QueryDict.dict()

返回 QueryDict 的字典表示.

Returns dict representation of QueryDict.