You are using str methods on an open file object.
You can read the file as a list of lines by simply calling list() on the file object:
with open(‘goodlines.txt’) as f:
mylist = list(f)
This does include the newline characters. You can strip those in a list comprehension:
with open(‘goodlines.txt’) as f:
mylist = [line.rstrip(‘n’) for line in f]
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.