Signed up recently but had issues with the confirmation email?
Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.
Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.
301.15 File Handling Techniques
Practise exam questionsFile Handling Techniques — Note 1 of 4
Open read write append.
Use open() with a mode to access a file. Common modes are "r" (read), "w" (write — overwrites), and "a" (append — adds to end). The with statement auto-closes the file.
"r" = read (default), "w" = write, "a" = append"w" overwrites the entire file — data is lost!"a" adds to the end without deleting existing contentwith open() as f: auto-closes when done# Read mode
with open("data.txt", "r") as f:
contents = f.read()
# Write mode (overwrites)
with open("output.txt", "w") as f:
f.write("Hello")
# Append mode (adds to end)
with open("log.txt", "a") as f:
f.write("New entry\n")Back to File Handling Techniques
Specification notes for programming are in Paper 2.