且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python将字典的文字值分配给另一个字典的键

更新时间:2023-02-11 19:56:25

如果要发布带有Python请求的 JSON ,则应使用data,但json:

If you want to post JSON with python requests, you should NOT use data but json:

r = requests.post('http://httpbin.org/post', json={"key": "value"})

由于您的示例,我只能猜测您正在使用data

I can only guess that you are using data because of your example

payload={url,headers, data={'file-data':{"key1": "3","key2": "6","key3": "8"}},files=files}

这不是有效的python语法.

Whis is not valid python syntax btw.