I am trying to write a code which will store movies on a list which I can retrieve by asking to add a movie either by its position or to check if it's on the list. So far, I have been working on the retrieving part, but I keep getting an error where "descriptor 'index' for 'list' objects doesn't apply to a 'str' object". This is my code so far
myFile = open("movies.txt", "a")
more = "yes"
while more.lower() == "yes":
movie = input("Please enter a movie title: ")
myFile.write(movie + '\n')
more = input("Would you like another item? Enter 'yes' or 'no'. ")
find = input("Would you like to find a movie? Enter 'yes' or 'no'. ")
myFile.close()
if find == "yes":
myFile = open("movies.txt")
xlist = list[myFile]
f2 = input("What movie would like to find?")
f3 = xlist.index(f2)
print(f2 + " is in number " + f3 + " on the list")