reference:
-
-
# f = open("test4.txt", 'w')
-
#
-
# f.write(b'hello world') # TypeError: write() argument must be str, not bytes
-
#
-
# f.close()
-
-
Open = f ( "test4.txt" , 'wb' ) # write binary mode
-
-
f.write ( b'hello world ' ) # binary write
-
-
f.close () # close the file
-
-
Open = F ( "the test4.txt files" , 'RB' ) # binary read
-
-
Print (reached, f.read ()) # b'hello World 'print data read out
-
-
f.close () # close the file
-