list=[] f = open('file.txt','r') for line in f: list.append(line.rstrip()) #if you want the replace rstrip by strip