pdf :

response = self.multi_requests(url=str(pdf_url))
reader = PdfFileReader(io.BytesIO(response.content))
writer = PdfFileWriter()
page_count = reader.getNumPages()
for i in range(1, page_count):
writer.addPage(reader.getPage(i))
fw = io.BytesIO()
writer.write(fw)
fw.flush()

fw.getvalue()   这个值就是二进制

 

dataframe:

io.StringIO(out_df.to_csv()).read()