【发布时间】:2012-08-11 02:51:17
【问题描述】:
我想知道是否可以在 Python 3 中使用enctype='multipart/form-data' 发布到表单。我环顾四周,只能找到 Python 2 的东西(例如海报)。
【问题讨论】:
标签: forms post python-3.x multipart
我想知道是否可以在 Python 3 中使用enctype='multipart/form-data' 发布到表单。我环顾四周,只能找到 Python 2 的东西(例如海报)。
【问题讨论】:
标签: forms post python-3.x multipart
使用requests,它支持python 3。
import requests
response = requests.post('http://httpbin.org/post', files={'file': open('filename','rb')})
print(response.content)
【讨论】: