大佬教程收集整理的这篇文章主要介绍了Scrum冲刺博客Day4,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
软件工程 | 网络工程1934 |
---|---|
这个作业要求在哪里 | 项目冲刺 |
这个作业的目标 | 站立式会议、燃尽图、签入记录、运行截图、每日总结 |
def getquestion(userid,number):#随机选择number个单词
db = pymysql.connect(host="localhost",user="root",password="28853379", database="grouP6")
cursor=db.cursor()
sql=" SELEct wordid,english from grouP6.word where wordid in(SELEct wordid from grouP6.user_"+str(userid)+" where status='0') order by rand() limit "+str(number)+";"
#print(sql)
cursor.execute(sql)
#db.commit()
results=cursor.fetchall()
return results
def getanswer(word):#获得四个中文选项,返回一个正确的和三个错误的
db = pymysql.connect(host="localhost",user="root",password="28853379", database="grouP6")
cursor=db.cursor()
sql=" SELEct chinese from grouP6.word where wordid!="+"'"+word+"'"+" order by rand() limit 3;"
cursor.execute(sql)
#db.commit()
results=cursor.fetchall()
sql="SELEct chinese from grouP6.word where english="+"'"+word+"'"+";"
print(sql)
cursor.execute(sql)
rightanswer=cursor.fetchall()
return rightanswer,results
# get_qu
def get_qu(body):
conc = pymysql.Connect(host='127.0.0.1', port=3306, user='root', password='28853379', database='grouP6', charset='utf8')
cur = conc.cursor()
try:
sql = "SELECT plan FROM user WHERE id = "+str(body[0])+";"
cur.execute(sql)
plan = cur.fetchall()[0][0]
sql = "SELEct wordid,english from grouP6.word where wordid in(SELEct wordid from grouP6.user_" + str(body[0]) + " where status='0') order by rand() limit "+str(plan)+";"
cur.execute(sql)
result = cur.fetchall()
data_list = []
for each in result:
sql = " SELEct chinese from grouP6.word where wordid!=" + "'" + str(each[1]) + "'" + " order by rand() limit 3;"
cnAns = cur.fetchall()
cnAns_list = [cnAns[0][0], cnAns[1][0], cnAns[2][0], each[2]]
random.shuffle(cnAns_list)
data_list.append({
"cn": each[2],
"en": each[1],
"cnAns": [cnAns_list[0], cnAns_list[1], cnAns_list[2], cnAns_list[3]]
})
except Exception as e:
print('操作失败:', E)
data_list = []
data_list.append({
"ret": 1,
"msg": str(E)
})
# 回滚数据
conc.rollBACk()
finally:
# 关闭游标对象
cur.close()
# 关闭连接
conc.close()
# 状态信息
status = "200 OK"
# 响应头信息
response_header = [
("Server", "PWS/1.1"),
# 指定编码格式,因为没有模板文件,可以通过响应头指定编码格式
("Content-Type", "text/html;charset=utf-8")
]
return status, response_header, str(data_list)
啊啦,暂时没有哦
以上是大佬教程为你收集整理的Scrum冲刺博客Day4全部内容,希望文章能够帮你解决Scrum冲刺博客Day4所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。