use file.readlines() instead of file.read()