python - Difference between `open` and `io.BytesIO` in binary streams - Stack Overflow

PHOTO EMBED

Wed Apr 13 2022 12:53:49 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user] #python

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

https://stackoverflow.com/questions/42800250/difference-between-open-and-io-bytesio-in-binary-streams