-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSampleSearchEngine.py
More file actions
53 lines (37 loc) · 1 KB
/
SampleSearchEngine.py
File metadata and controls
53 lines (37 loc) · 1 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
while(True):
table = {}
x = raw_input("Input Command: ")
if(x == "help"):
print "e for clean exit"
print "q 'item' for query"
print "a item::location for add"
if(x == "e"):
break
w = x.split("q ")
if(len(w) > 1):
f = open("Table.txt","r")
try:
table = eval(f.read())
except:
print "Table is Empty or There is an error"
f.close()
try:
print table[w[1]]
except:
print "Item not found, check spelling"
x = ""
w = x.split("a ")
if(len(w)> 1):
f = open("Table.txt","r")
try:
table = eval(f.read())
except:
print "Table is Empty or There is an error"
f.close()
f = open("Table.txt","w").close()
z = w[1].split("::")
table[z[0]] = z[1]
f = open("Table.txt","w")
f.write(str(table))
f.close()
x = ""