好的,所以我从 sqlite 数据库中提取一些数据,但在向用户显示时我无法弄清楚如何正确格式化它们......我使用的是 python 2.5。
studentid = raw_input("Enter your student ID: ")
cur.execute('SELECT APP_DECISION FROM APP_STATUS WHERE STUDENTID = ?', (studentid,))
appdecision = cur.fetchall()
cur.execute('SELECT GRANT FROM FINAID WHERE STUDENTID = ?', (studentid,))
grant = cur.fetchall()
if (appdecision == 'ACCEPTED'):
print 'congratulations'
else:
print 'sorry'
print (appdecision)
print (grant)
结果是这样打印的,
Enter your student ID: 100006
[(u'ACCEPTED',)]
[(9500,)]
我希望能够打印它,例如 Accepted 和 $9500 ....。如何检查特定值以便祝贺已被接受的用户?非常感谢!