I have a textfile, let\'s call it goodlines.txt and I want to load it and make a list that contains each line in the text file.
goodlines.txt
I tried using the
Try this:
>>> f = open('goodlines.txt') >>> mylist = f.readlines()
open() function returns a file object. And for file object, there is no method like splitlines() or split(). You could use dir(f) to see all the methods of file object.
open()
splitlines()
split()
dir(f)