本文整理汇总了Python中student.Student类的典型用法代码示例。如果您正苦于以下问题:Python Student类的具体用法?Python Student怎么用?Python Student使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Student类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: new_registration
def new_registration():
obj=Student()
obj.createbasicstudent(request.vars)
obj.insertstudent(db)
obj_academicdetails=Academicdetails()
obj_academicdetails.insertacademicdetails(request.vars.emailid,request.vars.rollno,db)
return dict(redirect(URL('student','login')))
开发者ID:ergaurav2,项目名称:placement-portal,代码行数:7,代码来源:student.py
示例2: store
def store(self, name, age, gpa, grade):
student = Student()
student.name = name
student.age = age
student.gpa = gpa
student.grade = grade
self.students.append(student)
开发者ID:RyanDawkins,项目名称:opl-prgm1,代码行数:7,代码来源:structconsole.py
示例3: testStudentClass
def testStudentClass():
print(BOLD + "Testing student class." + END)
s = Student("name", "surname", "[email protected]", 9.50, "county")
custom_assert("Student contains correct given name.", s.getName() == "name")
custom_assert("Student contains correct given surname.", s.getSurname() == "surname")
custom_assert("Student contains correct given e-mail.", s.getEmail() == "[email protected]")
custom_assert("Student contains correct given grade.", s.getGrade() == 9.5)
custom_assert("Student contains correct given county.", s.getCounty() == "county")
try:
s = Student("name123", "surname", "[email protected]", 9.50, "county")
custom_assert("Testing for raising exception for invalid name.", False)
except ValueError:
custom_assert("Testing for raising exception for invalid name.", True)
try:
s = Student("name", "surname123", "[email protected]", 9.50, "county")
custom_assert("Testing for raising exception for invalid surname.", False)
except ValueError:
custom_assert("Testing for raising exception for invalid surname.", True)
try:
s = Student("name", "surname", "email", 9.50, "county")
custom_assert("Testing for raising exception for invalid email.", False)
except ValueError:
custom_assert("Testing for raising exception for invalid email.", True)
try:
s = Student("name", "surname", "[email protected]", "9asd.50", "county")
custom_assert("Testing for raising exception for invalid grade.", False)
except ValueError:
custom_assert("Testing for raising exception for invalid grade.", True)
开发者ID:PlatonV,项目名称:CodePracicesWS,代码行数:28,代码来源:test.py
示例4: get
def get(self):
name = self.request.get('name')
school = self.request.get('school')
student = Student(name=name, university=school)
student.put()
message = '<ul><li>%s, %s</li></ul>' % (name, school)
self.response.write(message)
开发者ID:eileenrose,项目名称:eileenrose.github.io,代码行数:7,代码来源:main.py
示例5: main
def main():
outFile = open("students.dat", "wb")
course1 = Course("CSC 157-050", "B", 4)
course2 = Course("EGL 101-001", "C", 3)
course3 = Course("PHY 201-0C1", "A", 5)
course4 = Course("MAT 251-002", "B", 5)
pickle.dump(course1, outFile)
pickle.dump(course2, outFile)
pickle.dump(course3, outFile)
pickle.dump(course4, outFile)
student1 = Student("Jim Bob")
student1.addCourse(course1)
student1.addCourse(course2)
student1.addCourse(course3)
student1.addCourse(course4)
print(student1)
pickle.dump(student1, outFile)
print("Student data was written to students.dat")
outFile.close()
end_of_file = False
inFile = open("students.dat", "rb")
student_info = []
print("\nNow reading students.dat")
while not end_of_file:
try:
info = pickle.load(inFile)
#add info to a list
student_info.append(str(info)) #use the str method to convert the course into a string
except EOFError:
end_of_file = True
inFile.close()
print(student_info)
#add objects to a list
dict_courses = {"First": course1, "Second": course2, "Third": course3, "Fourth": course4}
for label, c in dict_courses.items():
print(label, c)
not_found = True
checks = [False, False, False, False]
while not_found:
for label, c in dict_courses.items():
if label == "First":
checks[0] = "First"
elif label == "Second":
checks[1] = "Second"
elif label == "Third":
checks[2] = "Third"
elif label == "Fourth":
checks[3] = "Fourth"
if checks[0] != False and checks[1] != False and checks[2] != False and checks[3] != False:
print(dict_courses[checks[0]])
print(dict_courses[checks[1]])
print(dict_courses[checks[2]])
print(dict_courses[checks[3]])
not_found = False
开发者ID:KodiakDraco,项目名称:PycharmProjects,代码行数:60,代码来源:test_Student_Course.py
示例6: addStudent
def addStudent():
studict = []
class_id = classed.pop()
while True:
sID = raw_input("ID:")
if sID == "#":
break
sName = raw_input("name:")
banji = class_id
dorm = input("dorm:")
sex = raw_input("sex:")
age = input("age:")
stuClass = Student(sID,sName,banji,dorm,sex,age)
studict.append(stuClass.getStudentArray())
print stuClass.getStudentArray()
sqlVar = datafun()
sqlVar.Insertdata("student_infor", studict)
rData = sqlVar.getOnedata("student_infor", 'id', studict[0][0])
print rData['id']
if rData['id'] == studict[0][0]:
return True
else:
print rData['name']
return False
开发者ID:writeing,项目名称:python_Manager,代码行数:25,代码来源:ManagerAction.py
示例7: home
def home():
checkstudentvalidlogin()
obj_student=Student()
#obj_student.getstudentbasicdetails("[email protected]",db)
obj_student.getstudentbasicdetails(session.emailid,db)
images1 = db().select(db.notice_details.ALL)
images2 = db().select(db.event_details.ALL)
return dict(images1=images1,images2=images2)
开发者ID:ergaurav2,项目名称:placement-portal,代码行数:8,代码来源:student.py
示例8: action1
def action1(self, name):
if name in Student._all_students:
self.read_email(Student.email_student(name))
else:
emails_back = Student.email_all_students()
for email in emails_back:
if email:
self.read_email(email)
return NEXT_ROUND
开发者ID:bishiguro,项目名称:AdventureGame,代码行数:10,代码来源:verbs.py
示例9: main
def main():
p = Person("Charlotte Smith", 45, 55555555)
s = Student("Kyle Smith", 24, 7777777, 12345641464, ['CS-332L', 'CS-312', 'CS-386'])
print(p.get_name())
print(s.get_name())
print(isinstance(s, Person))
开发者ID:DustinY,项目名称:CS332L_Python,代码行数:10,代码来源:person_tester.py
示例10: test_general
def test_general(self):
stu = Student('david')
stu.enrol_course('CSC148')
self.assertTrue(stu.is_takingcourse('CSC148'))
stu.drop_course('CSC148')
self.assertFalse(stu.is_takingcourse('CSC148'))
stu.drop_course('CSC148')
开发者ID:sinoforever,项目名称:Assignment-1,代码行数:7,代码来源:student_test.py
示例11: add_stu
def add_stu(self, stu_num, stu_psw):
user_list = self.list
new_stu = Student(stu_num, stu_psw)
new_stu.set_number(stu_num)
new_stu.set_password(stu_psw)
user_list[stu_num] = new_stu
self.set_user_list(user_list)
print "Success!"
开发者ID:evillog,项目名称:Student-management-system,代码行数:11,代码来源:admin.py
示例12: saveprofile
def saveprofile():
checkstudentvalidlogin()
obj_student=Student()
obj_student.createstudent(request.vars)
#obj_student.getstudentbasicdetails("[email protected]",db)
obj_student.updatestudent(session.emailid,db)
obj_academicdetails=Academicdetails()
obj_academicdetails.createacademicdetails(request.vars)
obj_academicdetails.updateacademicdetails(session.emailid,db)
return dict()
开发者ID:ergaurav2,项目名称:placement-portal,代码行数:11,代码来源:student.py
示例13: decode_object
def decode_object(json_dict):
if "__student__" in json_dict:
new_student = Student(json_dict["name"])
json_dict.pop("__student__")
for course, info in json_dict["work"].items():
new_student.add_course(course)
for type, progress in info.items():
progress_obj = Progress(type)
for lg, attempts in progress.items():
progress_obj.add_lg(lg)
for attempt in attempts:
progress_obj.add_attempt(attempt["lg"], \
Attempt(attempt["score"], attempt["outof"], \
attempt["date"], attempt["lg"], attempt["comment"]))
new_student.add_progress(course, type, progress_obj)
开发者ID:mghastin,项目名称:sbgrade,代码行数:15,代码来源:io.py
示例14: get
def get(self):
stu = Student.instance()
begin = self.get_argument('begin','0')
stu.logger.info(begin)
end = self.get_argument('end','0')
stu.logger.info(end)
name = self.get_argument('name','').strip()
if begin=='0' and end=='0':
stu.logger.info('begin =0 and end =0,so return the lastest 7 days quaninfo')
#get the last week quan info
end = datetime.today()
begin = end - timedelta(6)
else:
begin = datetime.strptime(begin,'%Y/%m/%d')
end = datetime.strptime(end,'%Y/%m/%d')
ret = getQuanInfoBetween(begin,end)
#generate xls
r = genxls(r'/opt/simp/static/downloads/quaninfo.xls',cquaninfo,ret)
if r:
stu.logger.info('generate xls file success')
else:
stu.logger.error('generate xls file failed')
total = len(ret)
ret = doPage(self,ret)
#stu.logger.info(ret)
#stu.logger.info(name)
#ret = self.filterStuName()
if name != '' :
ret = filter(lambda info: info.has_key('student') and info['student']==name ,ret)
self.finish('quan',ret,total=total)
开发者ID:danielit,项目名称:simp,代码行数:35,代码来源:student_handler.py
示例15: get_student_list
def get_student_list():
s_list = []
import os
print os.getcwd()
print "Reading roster ..."
f = open('roster_101/data/roster.txt', 'r')
for line in f:
stu = Student(line)
stu.grade()
s_list.append(stu)
return s_list
开发者ID:ymnliu,项目名称:roster_101,代码行数:16,代码来源:gen_templating.py
示例16: post
def post(self):
try:
if isStudent(self):
self.finish(success=False,notification='权限不足,无法修改数据')
return
stu = Student.instance()
stu.logger.info('set attend info')
ris = json.loads(self.request.body)['data']
if type(ris) == type({}):
ris= [ris]
for ri in ris :
#day = ri['date']
name = ri['student']
sid = stu.getStuIdOnName(name)
if sid == '':
stu.logger.error('cant find stu id of '+name)
self.finish(success=False,notification='姓名错误')
return
stu.logger.info(ri['idc'])
if ri.has_key('idc') and ri['idc'].startswith('reward_'):
stu.logger.info('modify reward info,first delete')
self.searchAndDelRI(sid,ri['idc'])
else:
stu.logger.info('a new reward info')
ri['idc'] = 'reward_' + stu.getuuid()
ret = stu.setRewardInfo(sid,ri)
except Exception,e:
stu.logger.error(e)
开发者ID:danielit,项目名称:simp,代码行数:32,代码来源:student_handler.py
示例17: getAttendInfoBetween
def getAttendInfoBetween(self,begin,end):
stu = Student.instance()
try:
if type(begin) != type(datetime) :
begin = datetime.strptime(begin,'%Y/%m/%d')
if type(end) != type(datetime) :
end = datetime.strptime(end,'%Y/%m/%d')
stu.logger.info(begin)
stu.logger.info(end)
if end < begin :
return []
days = (end-begin).days
stu.logger.info(days)
rets=[]
for n in range(0,days+1):
day = begin + timedelta(n)
day = day.strftime('%Y/%m/%d')
stu.logger.info(day)
ret = stu.getAttendInfo(day)
stu.logger.info(ret)
for info in ret:
info = json.loads(info)
rets.append(info)
return rets
except Exception,e:
stu.logger.error(e)
开发者ID:danielit,项目名称:simp,代码行数:29,代码来源:student_handler.py
示例18: get
def get(self):
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
settings_params = {"name": user.nickname(), "graduationProgress": 70}
render_template(self, "settings.html", settings_params)
开发者ID:bwerner9328,项目名称:pitt-got,代码行数:7,代码来源:settings.py
示例19: generate_local
def generate_local(cls):
students = Student.create_by_csv("data/students.csv")
mentors = Mentor.create_by_csv("data/mentors.csv")
year = 2016
location = "Budapest"
local_class = CodecoolClass(location, year, students, mentors)
return local_class
开发者ID:CodecoolBP20161,项目名称:a-mentor-s-life-in-an-oo-way-technocoolrapid,代码行数:7,代码来源:codecool_class.py
示例20: EditBox
class EditBox(StudentBox):
"""编辑学生信息 - 继承StudentBox"""
def __init__(self, student, callback):
super(EditBox, self).__init__()
self.callback = callback
self.setTitle("修改信息...")
self.setMsg("")
self.setButton("修改")
self.indexEdit.setText(student.index)
self.nameEdit.setText(student.name)
self.setSex(student.sex)
self.birthEdit.setText(student.birth)
self.majorEdit.setText(student.major)
self.gradeEdit.setText(student.grade)
self.classEdit.setText(student.classname)
self._student = Student()
def onFinished(self):
self.applyToStudent(self._student)
check, info = self._student.checkInfo()
if check:
self.callback(self._student)
else:
self.setMsg(info)
return check
开发者ID:Zaeworks,项目名称:StudentsManager,代码行数:29,代码来源:boxUI.py
注:本文中的student.Student类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论