Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
PYTHON FILES / CHAPTER 05 / Learn / LESSON 05
open modes: - "w" — write (create or overwrite) - "a" — append at end
with open("log.txt", "w", encoding="utf-8") as f: f.write("start\n") with open("log.txt", "a", encoding="utf-8") as f: f.write("end\n")
with open("log.txt", encoding="utf-8") as f: print(f.read())
write() does not add a newline — you add \n yourself.
Learn: write vs append.
LAUNCH STANDBY
›