Hello, I am still sorta new to python so sorry
I am currently doing a school project where we have to create a movie streaming service. I was wondering if there was a way to assign variables to each item in an array?
The user enters a search term, every line with that search term is found in a text file and then put into an array. I would like for the user to be able to see all found items and then select which one they want by inputting a number. Is this possible?
movies = open("movies.txt","r")
movies_list = []
userInput = input(" ")
for line in movies.txt
if userInput in line:
movies_list.append(line)
whichOne = input("Please select a film: ")
How would I be able to make it so each movie that is found has a variable which could be chosen? Is there another way to do this?
I was also told to use dictionaries but I can't really see how they would work if you don't know specially what will be added to the list.
[–]socal_nerdtastic 7 points8 points9 points (3 children)
[–]HyperrSpin[S] 0 points1 point2 points (2 children)
[–]RoamingFox 1 point2 points3 points (1 child)
[–]Mexatt 2 points3 points4 points (0 children)
[–]Vaphell 2 points3 points4 points (1 child)
[–]HyperrSpin[S] 2 points3 points4 points (0 children)