json.dump()、json.dumps(),序列化(encoder)将字典转成json格式字符串,以便传输存储。
json.load()、json.loads(),反序列化(decoder)json格式字符串转换成字典,便于分析处理。
# if one filefield upload muti files use :
files= [
(
"field1",open("test1.png","rb")
),
(
‘filed2‘,open(‘a2.xlsx‘,‘rb‘).read()
)
]
# if multi field upload several files use:
files= {
"field1" : ("filepath中的文件名称", open("filePath1", "rb")),
"field2" : ("filename2", open("filePath2", "rb"), "image/jpeg"),
"field3" : ("filename3", open("filePath3", "rb"), "image/jpeg", {"refer" : "localhost"})
}
相关文章
- 01-20intercepting IO request
- 01-20EBS 开发中如何动态启用和禁止请求(Current Request)的参数
- 01-20too many open files
- 01-20安装zsh后使用vim输出_arguments:451: _vim_files: function definition file not found
- 01-20ROS学习(seven):using the ros to edit files in ros
- 01-20在上传文件时候 request.setCharset对文件名有效 对普通文本域无效 需要通过手动转换编码方式编码
- 01-20解决SharePoint 2013 designer workflow 在发布的报错“负载平衡没有设置”The workflow files were saved but cannot be run.
- 01-20Web Performance Test: 如果使用Plugin过滤Dependent Request
- 01-20根据request获取请求客户端的外网ip
- 01-20未能加载文件或程序集“file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0