open_in_new
content_copy
buffer = io.BytesIO() # ... with open("test.dat", "wb") as f: f.write(buffer.getvalue())