I am trying to read a file using the following statement:
input = open("input.txt").read().split('\n')
So basically my objective is to read the file line by line and store results in an array. It works perfect when the file is not empty. When input file has only one line len(input) is 1, which is as expected.
But when the file is empty, len(input) still gives 1. What am I doing wrong?