request.GET、request.POST、request.body(持续更新)

1、request.GET:

print(request.GET)  # <QueryDict: {'page' : ['5'], 'id__gt' : ['4']}>

print(request.GET.urlencode())  # page=5&id__gt=4

# request.GET是一个QueryDict类型,
# 默认不可修改,若想修改 request.GET._mutable = True,或者创建时:params = QueryDict(mutable=True)
# request.GET.urlencode() 用于将k,v构造成URL格式字符串
# request.GET['page'] = 666

- ?name=alex&age=18&age=19
- params = { name:['alex', ], age:[18,19] }

- params['hobby'] = "鲁宁"
- params = { name:['小明', ], age:[18,19], hobby:[ 鲁宁,] }

- params.setlist('hobby',["鲁宁"])
- params = { name:['alex', ], age:[18,19], hobby:[鲁宁,] }

  

posted @ 2017-12-18 22:57  百连  阅读(2042)  评论(0编辑  收藏  举报