-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
53 lines (35 loc) · 1.21 KB
/
main.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
42
43
44
45
46
47
48
49
50
51
52
53
from PyPDF2 import PdfReader
import json
def check_prerequisites(target, courses):
prerequisites = []
for course in courses:
if course == target :
print("blahblah")
#prerequisites =
return prerequisites
def read_pdf_page(file_name, page_number):
pdf_file = open(file_name, 'rb')
reader = PdfReader(pdf_file)
page = reader.pages[page_number]
text = page.extract_text()
pdf_file.close()
return text
json_file = open('course_data.json', "r")
data = json.load(json_file)
for line in data['courses']:
if line['course'] == 'CSSE2310':
print(line)
json_file.close()
#Reading line by line so attributes can be properly filtered
# pdf_file = open("example.pdf",'rb')
# reader = PdfReader(pdf_file)
# pages = len(reader.pages)
# for i in range(pages):
# page = reader.pages[i]
# print("Page No: ", i + 1)
# text = page.extract_text().split("\n")
# for i in range(len(text)):
# print("Line Number : {i} - {text} \n\n".format(i = i, text = text[i].split(" ")))
# #print("Line Number : {i} - {text} \n\n".format(i = i, text = text[i]))
# print()
#pdf_file.close()