主页
Python
Python Requests post() 方法
demo_requests_post_files
运行 ❯
×
更改方向
保存代码
更改主题
import requests url = 'https://www.freew3c.com/python/demopage.php' myfiles = {'file': open('myfirstreact.png' ,'rb')} x = requests.post(url, files = myfiles) #print the response text (the content of the requested file): print(x.text)
C:\Users\My Name>python demo_requests_post_files.py
<!DOCTYPE html>
<html>
<body>
<h1>This is a Test Page</h1>
</body>
</html>