A lot of people find reading from a sequential file difficult. Well lets break it down, first of all what is a sequential file? A sequential file is a text based (ASCII or UNICODE) file that is made up of both printing and non printing characters. The end of the file is signalled with EoF, often programmers put data in separate lines using a new line character. Sometimes the files are in CSV format, which means that each line holds a records worth of data.
The basic premise of any Python read file access is
- Open file for reading
- read each line
- close file
This post will mostly be focused on different ways of doing step 2.