本文整理匯總了Python中course.Course.students[complete_name]方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.students[complete_name]方法的具體用法?Python Course.students[complete_name]怎麽用?Python Course.students[complete_name]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類course.Course
的用法示例。
在下文中一共展示了Course.students[complete_name]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load_from_file
# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import students[complete_name] [as 別名]
#.........這裏部分代碼省略.........
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)
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 self.is_tutor(complete_name, course):
continue
confirm_interaction = None
if complete_name in course.students:
student = course.students.get(complete_name)
confirm_interaction = student.set_interation(timestamp)
else:
student = Student(first_name, last_name)
confirm_interaction = student.set_interation(timestamp)
course.students[complete_name] = student
#Exclude the invalid dates
if confirm_interaction is not None:
course.add_to_week_average(timestamp, 1)
count_interaction += 1
data_student.close()
for student in course.students.itervalues():
student.set_average_by_week()
print "\n"
self.print_data_stats(count_interaction, course)
return course