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


Python Exercise.delete方法代码示例

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


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

示例1: str

# 需要导入模块: from models import Exercise [as 别名]
# 或者: from models.Exercise import delete [as 别名]
				print_student = "Delete: " + str(Student.select().where(Student.id==sys.argv[3]).get())	
				student = Student.delete().where(Student.id == sys.argv[3]).execute()
				print print_student
		elif sys.argv[2] == 'batch':
			if Batch.select().where(Batch.id==sys.argv[3]).count() == 0:
				print "Nothing to delete"
			else:
				print_batch = "Delete: " + str(Batch.select().where(Batch.id==sys.argv[3]).get())	
				batch = Batch.delete().where(Batch.id == sys.argv[3]).execute()
				print print_batch
		elif sys.argv[2] == 'exercise':
			if Exercise.select().where(Exercise.id==sys.argv[3]).count() == 0:
				print "Nothing to delete"
			else:
				print_exercise = "Delete: " + str(Exercise.select().where(Exercise.id==sys.argv[3]).get())	
				exercise = Exercise.delete().where(Exercise.id == sys.argv[3]).execute()
				print print_exercise		
	elif sys.argv[1] == 'print_batch_by_school':
		if School.select().where(School.id==sys.argv[2]).count() == 0:
			print "School not found"
		else:
			school = School.select().where(School.id==sys.argv[2]).get()
			for batch in school.batches:
				print batch
	elif sys.argv[1] == 'print_student_by_batch':
		if Batch.select().where(Batch.id==sys.argv[2]).count() == 0:
			print "Batch not found"
		else: 
			batch = Batch.select().where(Batch.id==sys.argv[2]).get()
			for student in batch.students: 
				print student
开发者ID:tasneemfarag,项目名称:holbertonschool-higher_level_programming,代码行数:33,代码来源:main.py


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