先介绍一下。我会发一篇文章到一个网址,它会有
ip、mac或主机名。现在,根据这些键中的哪一个在QueryDict中,我希望它能执行某些调用。即:
输出

print request.POST

<QueryDict: {u'ip': [u'10.1.24.178'], u'message': [u'Test'], u'client': [u'auabrthin1']}>

我想写这样的东西:
if request.POST['client'] in request.POST:
    do_something()

然而,显然客户端的价值在于我如何检查request.POST是否有密钥?

最佳答案

if 'client' in request.POST:
    # do something

关于python - Django/Python POST,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7873020/

10-16 20:42