首页 > 解决方案 > 在 Python 中解析查询字符串中的字典?

问题描述

像这样编码查询字符串是相当标准的:

urlencode({
  'a': {
    'b': 1
  },
})
# a[b]=1

然而:

parse_qs('a[b]=1')
# {'a[b]': 1}

Python 是否有内置函数来解析包含 dicts 的查询字符串?如果没有,那么干净的方法是什么?

标签: pythonquery-string

解决方案


推荐阅读