本文整理匯總了Python中course.Course.professors[complete_name]方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.professors[complete_name]方法的具體用法?Python Course.professors[complete_name]怎麽用?Python Course.professors[complete_name]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類course.Course
的用法示例。
在下文中一共展示了Course.professors[complete_name]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load_from_file
# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import professors[complete_name] [as 別名]
def load_from_file(self, course_file_path, course_name, begin_date, end_date):
print "\nStarting to load \'" + course_file_path + "\' file.\n"
students_file_path = course_file_path + "students.in"
professors_file_path = course_file_path + "professors.in"
tutors_file_path = course_file_path + "tutors.in"
ignore_file_path = course_file_path + "ignore"
ignored_names = self._get_ignored_names(ignore_file_path)
data_student = open(students_file_path)
data_professor = open(professors_file_path)
data_tutors = open(tutors_file_path)
data_size = os.path.getsize(students_file_path) + os.path.getsize(professors_file_path) \
+ os.path.getsize(tutors_file_path)
# Put the carret at the right place
data_processed = len(data_professor.readline()) + len(data_professor.readline())
data_processed = data_processed + len(data_student.readline()) + len(data_student.readline())
data_processed = data_processed + len(data_tutors.readline()) + len(data_tutors.readline())
course = Course(course_name)
count_interaction = 0
#Professors loader
for line in data_professor:
data_processed = data_processed + len(line)
self.progress_load(data_size, data_processed)
new_line = remove_white_space(line)
split_line = string.split(new_line, "|")
#split_line must have 3 position
if len(split_line) != 3:
continue
complete_name = split_line[0]+" "+split_line[1]
first_name = split_line[0]
last_name = split_line[1]
timestamp = split_line[2]
if complete_name in ignored_names:
continue
if not begin_date < int(timestamp) < end_date:
continue
if complete_name in course.professors:
professor = course.professors.get(complete_name)
conf_interaction = professor.set_interation(timestamp)
else:
professor = Professor(first_name, last_name)
conf_interaction = professor.set_interation(timestamp)
course.professors[complete_name] = professor
data_professor.close()
#Tutors loader
for line in data_tutors:
data_processed = data_processed + len(line)
self.progress_load(data_size, data_processed)
new_line = remove_white_space(line)
split_line = string.split(new_line, "|")
#split_line must have 3 position
if len(split_line) != 3:
continue
complete_name = split_line[0]+" "+split_line[1]
first_name = split_line[0]
last_name = split_line[1]
timestamp = split_line[2]
if complete_name in ignored_names:
continue
if not begin_date < int(timestamp) < end_date:
continue
if self.is_professor(complete_name, course):
continue
if complete_name in course.tutors:
tutor = course.tutors.get(complete_name)
tutor.set_interation(timestamp)
else:
tutor = Tutor(first_name, last_name)
tutor.set_interation(timestamp)
course.tutors[complete_name] = tutor
data_tutors.close()
#Students loader
for line in data_student:
data_processed = data_processed + len(line)
#.........這裏部分代碼省略.........