request.POST是类似于字典的对象,包含所有给定的HTTP POST参数。
当您遍历时
request.POST,只会得到密钥。
for key in request.POST: print(key) value = request.POST[key] print(value)
若要一起检索键和值,请使用
items方法。
for key, value in request.POST.items(): print(key, value)
请注意,
request.POST每个键可以包含多个项目。如果每个键都需要多个项目,则可以使用
lists,它将所有值作为列表返回。
for key, values in request.POST.lists(): print(key, values)
有关更多信息,请参见的Django文档
QueryDict。



