修改界面
This commit is contained in:
+12
-1
@@ -22,6 +22,17 @@ class Question:
|
||||
questions.append(Question(*line.strip('\n').split(',')))
|
||||
return questions
|
||||
|
||||
@staticmethod
|
||||
def load_from_xls(path: str) -> list['Question']:
|
||||
questions = []
|
||||
wb = load_workbook(path, read_only=True)
|
||||
ws = wb.active
|
||||
for row in ws.iter_rows(min_col=2, max_col=3, min_row=2, values_only=True):
|
||||
if row[0] is None and row[1] is None:
|
||||
break
|
||||
questions.append(Question(*row))
|
||||
return questions
|
||||
|
||||
@property
|
||||
def no(self) -> str:
|
||||
return self._no
|
||||
@@ -112,4 +123,4 @@ class Course:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
...
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user