OK, so I am pulling some data from a sqlite database and I can't figure out how to properly format them when showing to the users...I'm using 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'):
the results are getting printed like so,
Enter your student ID: 100006
I want to be able to print it such as Accepted, and $9500....also. How do I check for the specific value so I can congratulate the users which have been accepted?
Thanks so much!
Print it as:
print (appdecision) print (grant)
This is because
[(u'ACCEPTED',)] is a list that contains a tuple that contains the string
"ACCEPTED". Similarly, you'll have to check for a value like this:
if appdecision == "ACCEPTED": print "Congratulations!"