Common Mistakes

Week 7 - File Handling

1. Pathway

If your code and file are not in the same folder, you need to call the file using a specific path. 

However, for all intents and purposes in this course, we will have the required file in the same path as your code.  

2. Missing next line/tabs

In Python, \n is used to add a new line, and \t is used to add a tab character in between the operands.

3. Choosing the correct file operation to open

The table below is taken from the Python documentation and shows which file operation is intended to be applied to the file: