当前位置: 首页>>代码示例>>Python>>正文


Python Question.parse_content_from_xml方法代码示例

本文整理汇总了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
开发者ID:kmill,项目名称:news_crowdsourcer,代码行数:20,代码来源:xmltask.py


注:本文中的question.Question.parse_content_from_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。