To read a file line by line, you will need to use readlines method of file object. This function reads lines to a list, which then can be used in iterating lines. Here is a really basic code for reading a file line by line:

with open(fname) as f:
  content = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
content = [x.strip() for x in content]