2 odpowiedzi
+ 7
You use the open command. It takes two parameters. First is the filename as a string. Second is the open mode as a string. The open mode can be "wb" to write binary or "rb" to read binary.
with open("file.dat", "wb") as f:
f.write(myblob)
+ 4
To read a binary file, you need to open it in 'rb' mode (read binary mode). You can read the binary content using read(). Here is a sample code snippet, e.g.
https://sololearn.com/compiler-playground/cjb6HPDdto3j/?ref=app