summaryrefslogtreecommitdiff
path: root/search_past_papers.py
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-06-16 15:57:05 +0000
committerRunxi Yu <me@runxiyu.org>2024-06-16 15:57:05 +0000
commitc587f0b66ae75a2a8f1c6cad30b492cbeb2dfc8e (patch)
tree2dd4ac678b4c696553862cbbd95a971591ae3fb1 /search_past_papers.py
parentf92bab5c8e2fe3829f8f85bb9e039db2ec2b01de (diff)
downloadalbertscripts-c587f0b66ae75a2a8f1c6cad30b492cbeb2dfc8e.tar.gz
albertscripts-c587f0b66ae75a2a8f1c6cad30b492cbeb2dfc8e.zip
Add everything related to past papers searching
Diffstat (limited to 'search_past_papers.py')
-rw-r--r--search_past_papers.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/search_past_papers.py b/search_past_papers.py
new file mode 100644
index 0000000..a053226
--- /dev/null
+++ b/search_past_papers.py
@@ -0,0 +1,17 @@
+import json
+
+subject_code = input("Subject code: ")
+dic = json.load(open(f"{subject_code}.json"))
+search_str = input("Word or words to be searched: ").lower()
+flag = True
+print("\nThe following are files that contain such string: ")
+
+for year in dic.keys():
+ for file in dic[year].keys():
+ for page in dic[year][file].keys():
+ if search_str in dic[year][file][page]:
+ print(file, f"[Page {page}]")
+ flag = False
+
+if flag:
+ print("No file found")