Python+Sequential+File+Handling


 * Reading from a file sequentially**

Reading from a file sequentially means starting at the beginning, and reading all of the information right up to the end of the file. Normally this information would be stored in a variable.

Steps: 1. Open the file 2. Read the file into a variable 3. Close the file


 * Writing to a file sequentially**

Writing to a file sequentially means writing a variable or some data to a file in order.

Steps 1. Open the file 2. Write data / variable to the file 3. Close the file

Code
1. Download this file to your Python project folder 2. Copy the code below 3. When the program has run, open the Python project folder and then open the file //**new file.txt**//



Extension Task
Create 3 text files, each storing a sentence. Save each file with a different name in your project folder

Write a program which
 * asks the user for the name of the file to be opened
 * opens the file and reads the sentence from it
 * asks the user to input a second sentence
 * joins the two sentences together
 * asks the user for the name of a new file
 * saves the sentences to a new file with this name