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"})
}

相关文章:

  • 2021-07-16
  • 2022-03-07
  • 2021-09-18
  • 2022-12-23
  • 2021-11-11
  • 2021-12-22
  • 2021-12-22
  • 2022-12-23
猜你喜欢
  • 2021-07-03
  • 2021-06-20
  • 2021-12-05
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
相关资源
相似解决方案