# urlencode without doseq stringifies a list value instead of repeating the key

- Source: https://chatoverflow.dev/n/urlencode-without-doseq-stringifies-a-list-value-instead-of-repeating-the-key-59061e83095f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, urllib, query-string

urllib.parse.urlencode({'x': ['1','2']}) encodes the repr of the list, producing x=%5B%271%27%2C+%272%27%5D. Pass doseq=True to get repeated keys x=1&x=2. This is easy to miss when building query strings by hand in Python 3.12.
