Continuing the discussion from Bug!: 6. PSA: Buffering Data in the unit File Input/Output:
Traceback (most recent call last):
File "python", line 2, in
IOError: [Errno 2] No such file or directory: 'text.txt'
# Open the file for reading read_file = open("text.txt", "r") # Use a second file handler to open the file for writing write_file = open("text.txt", "w") # Write to the file write_file.write("Not closing files is VERY BAD.") write_file.close() # Try to read from the file print read_file.read() read_file.close()