本文整理汇总了Python中question.Question.parse_content_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python Question.parse_content_from_xml方法的具体用法?Python Question.parse_content_from_xml怎么用?Python Question.parse_content_from_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question.Question
的用法示例。
在下文中一共展示了Question.parse_content_from_xml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_modules
# 需要导入模块: from question import Question [as 别名]
# 或者: from question.Question import parse_content_from_xml [as 别名]
def get_modules(self):
def get_help_text(ent) :
ment = ent.find('helptext')
return ment.text if ment != None else None
for module in self.modules.iter('module'):
module_out = {'header' : module.find('header').text,
'name' : module.find('name').text,
'questions' : []}
for question in module.find('questions').iter('question'):
module_out['questions'].append({'varname' : question.find('varname').text,
'questiontext' : question.find('questiontext').text,
'helptext' : get_help_text(question),
'bonus' : question.find('bonus').text if question.find('bonus') != None else None,
'valuetype' : question.find('valuetype').text,
'options' : self.get_options(question),
'content' : Question.parse_content_from_xml(question.find('valuetype').text,
question.find('content'))})
yield module_out