I am wondering is it possible to replace contents without?
I have tried this with file.write()
, however, it has just been added to the content of the file, not replacing it. Does it possible to replace the contents in a file without deleting the file itself?
the_json_file.write_all(inside_da_file.as_bytes()).expect("Failed to write");
I wanted to clear out the file before I write into it.