http.server服务端post请求接收图片无法识别
作者:互联网
req_datas = self.rfile.read(int(self.headers['content-length']))
pattern1 = re.compile(b"-+\w*\s{2}(.*?\s{2}){2}\s{2}")
pattern2 = re.compile(b"\s{2}-+.+\s{2}")
res1 = re.match(pattern1, req_datas)
res2 = re.search(pattern2, req_datas)
file_data = req_datas[res1.end():res2.start()]
with open("qqq.jpg", "wb") as w:
w.write(file_data)
标签:http,self,req,server,pattern2,re,file,post,datas 来源: https://www.cnblogs.com/xuezhihao/p/11380913.html