Introduction
In this blog, I am going to show how to post data into a demo form in Python. It will post the user data into a demo form in the web browser.
Software requirement
Python 3.5 and IDLE (Python 3.5) or above
Programming code
-
-
- import requests
-
- mydata={"name":"raj", "email": "[email protected]"}
-
- r=requests.post("https://www.w3schools.com/php/welcome.php", data=mydata)
-
- f=open("myfile.html","w+")
- f.write(r.text)
About the code
First, I am importing the request modules.
Next, set posting data and request to a demo form page.
Finally, I have written the output statement to show the result in a web browser.
Then, let’s execute the code.
Form
Before executing the code.
After executing the code.