Python and POST data

In PHP, I just write:

$bob = $_POST['bob']; 

How do I do the same in Python?

And yes, I usually check that it exists, etc., I just remove it specifically for the functionality that I use.


Edit: I do not use the framework
+4
source share
1 answer

The simplest method is the cgi module:

 import cgi data = cgi.FieldStorage() data['bob'] 

But the context that you execute in (the framework you use, WSGI, or even (sky) mod_python) may have different, more efficient, or more direct access methods.

+10
source

Source: https://habr.com/ru/post/1277036/


All Articles