I have a table populated with values, one being date in the YYYY-MM-DD format. I'm trying to print all "cost" values by month. So,
def SumByMonth():
usrDate = raw_input('Enter month: ')
sql = '''SELECT cost FROM Finance WHERE strftime('%m', date) = ?''', (usrDate)
month_cost = [t[0] for t in cur.execute(sql)]
print month_cost
This code gives me this error:
ValueError: operation parameter must be str or unicode
So I figure the SQL command isn't actually extracting anything? What am I missing here?