擅长:python、mysql、java
<p>你想要的</p>
<pre><code>import json
mydata = {}
mydata['api_key'] = "Jsa9i23jka"
r = requests.delete(URL_delete, data=json.dumps(mydata))
</code></pre>
<p>您必须使用命名输入“data”,我猜您实际上希望转储JSON,因此必须将字典“mydata”转换为JSON字符串。您可以使用json.dumps()来实现这一点。</p>
<p>我不知道你正在使用的API,但是根据它的声音,你实际上想要传递URL参数,而不是数据,因为你需要:</p>
<pre><code>r = requests.delete(URL_delete, params=mydata)
</code></pre>
<p>不需要将<code>mydata</code>dict转换为json字符串。</p>