How are POST and GET variables handled in Python?

前端 未结 6 613
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 11:59

In PHP you can just use $_POST for POST and $_GET for GET (Query string) variables. What\'s the equivalent in Python?

6条回答
  •  -上瘾入骨i
    2020-11-22 12:39

    They are stored in the CGI fieldstorage object.

    import cgi
    form = cgi.FieldStorage()
    
    print "The user entered %s" % form.getvalue("uservalue")
    

提交回复
热议问题