-
Notifications
You must be signed in to change notification settings - Fork 0
/
array.py
41 lines (35 loc) · 1.08 KB
/
array.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import csv,time
def find(storage,query):
flag = False
ans = []
count = 0
for i in storage:
if query.lower() == i.lower():
flag = True
ans.append(i)
count += 1
return flag,ans,count
with open('Dataset/netflix_titles.csv', encoding="utf-8") as csvfile1:
reader = csv.reader(csvfile1)
storage1 = list()
for row in reader:
storage1.append(row[2])
csvfile1.close()
with open('Dataset/tmdb_5000_movies.csv', encoding="utf-8") as csvfile2:
reader2 = csv.reader(csvfile2)
storage2 = list()
for row in reader2:
storage2.append(row[6])
csvfile2.close()
final_storage = storage1 + storage2
print("Enter the name of the movie you want to search: ")
query = input()
start_time = time.time()
flag,ans,count = find(final_storage,query)
if(flag):
print("%s number of occurences found!" %count)
for i in ans:
print(i)
if(not flag):
print("No occurence found!")
print("The runtime of the program is : %s" %(time.time()-start_time))