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


Python Course.professor方法代码示例

本文整理汇总了Python中course.Course.professor方法的典型用法代码示例。如果您正苦于以下问题:Python Course.professor方法的具体用法?Python Course.professor怎么用?Python Course.professor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在course.Course的用法示例。


在下文中一共展示了Course.professor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse

# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import professor [as 别名]
    def parse(self):
        """Return a list of all courses formatted from the html file."""
        tree = make_tree(self.url)
        is_summer = (self.semester == 'summer')
        tree = clean_html(tree, is_summer)

        tables = tree.xpath('//table')
        courses = []
        for t in tables:
            td = t.xpath("td[contains(@class, 'cusistabledata')]")
            # Since it is not possible to find the tr elements using
            # lxml we find all the td elements and make a 2 dimensional
            # array representing the table.
            rows = [td[i:i + 8] for i in xrange(0, len(td), 8)]

            course_term = []
            seen_course = {}
            # result = None
            for row in rows:
                course = Course()
                # Course name ex: COMP + 352 / 1
                course_name = '{} {}'.format(row[2].text, row[3].text)

                # Group same course together.
                # result, seen_course = self.same_course(
                #     course_name, seen_course)

                ((course.colorid, course.summary),
                    seen_course) = self.same_course(course_name, seen_course)

                course.datetime_day = row[0].text
                course.time = row[1].text
                course.room = row[5].text
                course.campus = row[6].text
                course.professor = row[7].text

                course.section = row[4].text
                course.semester = self.semester
                # Append the summer section to the semester.
                if is_summer:
                    course.semester += get_summer_section(
                        course.section.split(' ')[1][0])
                # Append the buildings address of a specific course and format
                # the data.
                course.format_data(self.buildings)
                course_term.append(course)
            # Make sure to not to have 2 instances of the same course.
            course_term = recurent_event_factor(course_term)
            courses.append(course_term)
        return courses
开发者ID:samuelmasuy,项目名称:Concordia-Schedule-to-Gcal,代码行数:52,代码来源:scraper.py


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