1/30
Chapter 12 - Files
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Use open("filename.txt","r"); raises FileNotFoundError if missing.
Lines include "\n"; remove with rstrip().
Use write(); convert numbers to strings.
Writes may be delayed; flush() forces writing.
Text stores characters; binary stores raw bytes.
Use csv.reader; rows come as lists of strings.
Reader returns strings; convert manually.
Use csv.reader(..., delimiter=";").
Use csv.writer with writerow() or writerows(); newline="" on Windows.