feat: 自動從 generalCourse.in 讀取資料,修改通識課程分類(#20)
This commit is contained in:
parent
f351e73844
commit
4485c14503
137
generalCourse.in
Normal file
137
generalCourse.in
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
department 特色通識—在地實踐
|
||||||
|
994017
|
||||||
|
994057
|
||||||
|
994065
|
||||||
|
994068
|
||||||
|
994071
|
||||||
|
994075
|
||||||
|
994076
|
||||||
|
994077
|
||||||
|
994078
|
||||||
|
994080
|
||||||
|
994086
|
||||||
|
994089
|
||||||
|
994112
|
||||||
|
994113
|
||||||
|
994114
|
||||||
|
department 特色通識—綠概念
|
||||||
|
993062
|
||||||
|
994001
|
||||||
|
994012
|
||||||
|
994020
|
||||||
|
994024
|
||||||
|
994074
|
||||||
|
994027
|
||||||
|
department 特色通識—東南亞
|
||||||
|
992106
|
||||||
|
994030
|
||||||
|
994096
|
||||||
|
994098
|
||||||
|
994099
|
||||||
|
994102
|
||||||
|
994103
|
||||||
|
994105
|
||||||
|
994108
|
||||||
|
994109
|
||||||
|
994110
|
||||||
|
994111
|
||||||
|
994010
|
||||||
|
department 自然—生命與科學
|
||||||
|
993001
|
||||||
|
993002
|
||||||
|
993022
|
||||||
|
993054
|
||||||
|
993086
|
||||||
|
993093
|
||||||
|
993106
|
||||||
|
993126
|
||||||
|
993131
|
||||||
|
993132
|
||||||
|
993133
|
||||||
|
993137
|
||||||
|
993145
|
||||||
|
993008
|
||||||
|
department 自然—工程與科技
|
||||||
|
993023
|
||||||
|
993052
|
||||||
|
993055
|
||||||
|
993060
|
||||||
|
993064
|
||||||
|
993075
|
||||||
|
993116
|
||||||
|
993156
|
||||||
|
993157
|
||||||
|
993013
|
||||||
|
993066
|
||||||
|
993111
|
||||||
|
993120
|
||||||
|
993143
|
||||||
|
department 社會—社經與管理
|
||||||
|
991094
|
||||||
|
992033
|
||||||
|
992035
|
||||||
|
992110
|
||||||
|
992120
|
||||||
|
992129
|
||||||
|
992141
|
||||||
|
992143
|
||||||
|
992177
|
||||||
|
992191
|
||||||
|
992193
|
||||||
|
992203
|
||||||
|
992205
|
||||||
|
992213
|
||||||
|
992214
|
||||||
|
992216
|
||||||
|
992217
|
||||||
|
992223
|
||||||
|
992062
|
||||||
|
992211
|
||||||
|
992232
|
||||||
|
department 社會—法政與教育
|
||||||
|
984003
|
||||||
|
992076
|
||||||
|
992108
|
||||||
|
992112
|
||||||
|
992178
|
||||||
|
992179
|
||||||
|
992180
|
||||||
|
992188
|
||||||
|
992206
|
||||||
|
992234
|
||||||
|
992185
|
||||||
|
department 人文—歷史哲學與文化
|
||||||
|
991068
|
||||||
|
991075
|
||||||
|
991087
|
||||||
|
991140
|
||||||
|
991144
|
||||||
|
991154
|
||||||
|
991163
|
||||||
|
991192
|
||||||
|
991199
|
||||||
|
991212
|
||||||
|
992073
|
||||||
|
992087
|
||||||
|
992171
|
||||||
|
994044
|
||||||
|
department 人文—文學與藝術
|
||||||
|
460135
|
||||||
|
991040
|
||||||
|
991062
|
||||||
|
991065
|
||||||
|
991069
|
||||||
|
991167
|
||||||
|
991170
|
||||||
|
991183
|
||||||
|
991190
|
||||||
|
991193
|
||||||
|
991201
|
||||||
|
991203
|
||||||
|
991207
|
||||||
|
991209
|
||||||
|
991210
|
||||||
|
991211
|
||||||
|
992176
|
||||||
|
991032
|
||||||
|
991071
|
||||||
30
generalCourse.py
Normal file
30
generalCourse.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
with open("output.json") as fp:
|
||||||
|
courses = json.load(fp)
|
||||||
|
|
||||||
|
with open("generalCourse.in") as fp:
|
||||||
|
line = fp.readline()
|
||||||
|
while line:
|
||||||
|
count = 0
|
||||||
|
line = line.split()
|
||||||
|
if len(line) == 2:
|
||||||
|
department = line[1]
|
||||||
|
else:
|
||||||
|
for course in courses:
|
||||||
|
if course['number'] == line[0]:
|
||||||
|
course['department'] = department
|
||||||
|
count += 1
|
||||||
|
if count == 0 and len(line) != 2:
|
||||||
|
print("{} 可能輸入錯誤 - {}".format(line[0], department))
|
||||||
|
line = fp.readline()
|
||||||
|
|
||||||
|
print("還沒有對應到的課程:")
|
||||||
|
for course in courses:
|
||||||
|
if course['department'] == "99, 通識":
|
||||||
|
course['department'] = "99, 通識(未分類)"
|
||||||
|
print("{} {}".format(course['number'], course['name']))
|
||||||
|
|
||||||
|
with open("output.json", "w") as fp:
|
||||||
|
json.dump(courses, fp, ensure_ascii=False)
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user