所以我在这段代码片段中遇到了问题。数据库不是问题所在,并且已完全填充。现在应该调出控制台/命令行,然后我可以根据需要输入信息。 例如,问题数据库中的问题是:
“最近两个星期,您有流感症状吗?”
当前,这段代码什么都不会产生,当我从问题字典更改为然后将它们添加到数据库并尝试从数据库中提取它们时,我对python编码还是相当陌生。我确实知道问题出在代码的第一行,因为从字典开始运行该代码以前是有效的。
#Question1
conn.execute("SELECT question from question WHERE questionID = '1'")
question1 = conn.fetchone()
# print the question
print (question1())
# use the question 1 choices to get an answer
answer = input(question1.get()).lower()
if answer == question1.get(answer):
c = conn.execute("SELECT illnessID, Illness, illnessinfo from illnesses WHERE illness = 'Flu'")
for row in c:
print( "Illness Identifier = ", row[0])
print( "Suspected Illness= ", row[1])
print( "Displayed Symptom = ", row[2])
print("Thanks this has been recorded.")
ident = ident + " - " + row[1]
c = conn.execute("SELECT drugID, drug from drugs WHERE drug = 'Flu injection'")
for row in c:
print( "Drug = ", row[0])
print( "Drug = ", row[1])
pescr = pescr + " - " + row[1]
print(ident)
print(pescr)
print("\n")
else:
print("Okay Next question.")
c.execute("INSERT OR IGNORE INTO question(questionID, question) VALUES(1,'Over the last two weeks have you have symptoms of the flu?')")
c.execute("INSERT OR IGNORE INTO choices (choicesID, choices) VALUES(1,'Yes')")
c.execute("INSERT OR IGNORE INTO choices (choicesID, choices) VALUES(2,'No')")
c.execute("INSERT OR IGNORE INTO answer (answerID, answer) VALUES(1,'Yes')")
c.execute("INSERT OR IGNORE INTO answer (answerID, answer) VALUES(2,'No')")
答案 0 :(得分:1)
我的猜测是var parts ='01.02.19'.split('.');
var mydate = new Date(parts[0], parts[1], parts[2]);
应该替换为print (question1())
question1应该包含一个不可调用的元组。
但是那应该给你一个错误...