[英]Python requests, how to send json request without “ ”
my code looks like我的代码看起来像
data = {
"undelete_user":'false'
}
data_json = json.dumps(data)
print(data_json)
Output is: Output 是:
{"undelete_user": "false"}
i need output to be without "" so it can look like我需要 output 没有“”所以它看起来像
{"undelete_user": false}
otherwise when i send request, i will get "failed to decode JSON" error否则当我发送请求时,我将收到“无法解码 JSON”错误
import json
data = {
"undelete_user": False
}
data_json = json.dumps(data)
print(data_json)
All you had to do was remove 'false' and put False, because you're considering your false as a string, and it should be a boolean.您所要做的就是删除'false'并放入False,因为您将false视为字符串,它应该是boolean。 I hope it helped!
我希望它有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.