你的项目简介
aiken的Python项目详细描述
这个项目是moodle中使用的aiken问题格式的python解析器。 aiken是表示多项选择题的一种非常简单的格式(https://docs.moodle.org/24/en/Aiken_format) 它接受两个非常相似的语法:
What is the correct answer to this question? A. Is it this one? B. Maybe this answer? C. Possibly this one? D. Must be this one! ANSWER: D
这个:
Which LMS has the most quiz import formats? A) Moodle B) ATutor C) Claroline D) Blackboard E) WebCT F) Ilias ANSWER: A
用法
aiken模块只需公开分别为 解析问题文件并将解析的问题对象转换回代码。让我们 分析问题字符串:
>>> import aiken >>> question = aiken.load(""" ... Is this a valid Aiken Question? ... A. Yes ... B. No ... ANSWER: A ... """) >>> question.options ['Yes', 'No']
现在,我们进行一些更改并将其转换回一个代码字符串:
>>> question.options.append('Who knows?') >>> print(aiken.dump(question)) Is this a valid Aiken Question? A. Yes B. No C. Who knows? ANSWER: A