字符串索引必须是整数,而不是str - django

时间:2017-04-23 20:58:33

标签: python json django post

我正试图将此传递到前端的帖子中,但我继续在此行上收到此错误,我无法弄清楚为什么会这样

{"isUpdated": true}通过此

在我的django中,我有这些

    body_unicode = request.body.decode('utf-8')
    data = json.loads(body_unicode)

    if data['isUpdated'] is not False:
     # more codes

我继续在if data['isUpdated'] is not False:

上收到错误

有人可以告诉我发生了什么事吗?

1 个答案:

答案 0 :(得分:0)

private void listViewItem_MouseDown(object sender, RoutedEventArgs e) { if (e.OriginalSource is Image) return; // do nothing MessageBox.Show("ROW CLICKED"); } 错误意味着<Target Name="AfterResolveReferences"> <Exec Command="path\MyFirstCommand.exe -parameters" /> </Target> <Target Name="MySecondCommand" AfterTargets="AfterResolveReferences" > <Exec Command="path\MySecondCommand.exe -parameters" /> </Target> 变量包含一个字符串,并且Python抱怨它不能使用字符串来访问该字符串中包含的字符(string indices must be integers, not str将返回第一个字符,data会返回第二个字符,依此类推,但data[0]会返回什么?)

请求正文包含哪些内容?只是帖子的文本,还是JSON对象?

相关问题