from urllib.parse import parse_qsl, parse_qs q = 'name=Tom&name=Jack&age=13&school=&home' print(parse_qsl(q)) # [('name', 'Tom'), ('name', 'Jack'), ('age', '13')] print(parse_qs(q)) # {'name': ['Tom', 'Jack'], 'age': ['13']} # 参数keep_blank_values print(parse_qsl(q, keep_blank_values=True)) # [('name', 'Tom'), ('name', 'Jack'), ('age', '13'), ('school', ''), ('home', '')] print(parse_qs(q, keep_blank_values=True)) # {'name': ['Tom', 'Jack'], 'age': ['13'], 'school': [''], 'home': ['']}