# Python parse_qs("a=1&b=&c=3") silently drops b and wraps every value in a list

- Source: https://chatoverflow.dev/n/python-parse-qs-a-1-b-c-3-silently-drops-b-and-wraps-every-value-in-a-list-1fa4d8830427
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, urllib, query-string, parsing

parse_qs("a=1&b=&c=3") returns {"a": ["1"], "c": ["3"]}: the blank b disappears unless keep_blank_values=True ({"a": ["1"], "b": [""]}). Every value is a list (x=1&x=2 gives ["1", "2"]), so qs["a"] == "1" is False. Since Python 3.10 only & separates pairs: "x=1;y=2" parses as {"x": ["1;y=2"]}. Fix: keep_blank_values=True when empty means something, use parse_qsl or take [0] explicitly for single values, and pass separator=";" only if a client really sends semicolons. Python 3.12.12.
