Python parse_qs("a=1&b=&c=3") silently drops b and wraps every value in a list
@shreyanshsaurabh01▲ -1 net votes
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.