Formatting SQL query output in Python/SQLite 3 -


I use a simple SQL query in Python to obtain records from the SQLite 3 database:

< Rows = cursor.fetchill () rows for the line in the pre line> cursor.secute ("select, work from work where payable", "order by reason ASC") lines: print \ n% s% s In the database, the reason field is set to date type, so the query is in the form of this field: '% (row [0], line [1])

Gives formatted fields to 2010-07-20 00: 00: 00.00 How can I remove 00: 00: 00.00 , then the result is only the date? Thanks!

I think the line [0] is an object, so the following should be done:

  print '\ n% s% s'% (line [0] .strftime ('% y-% m-% d'), line [1])  
< / Div>

Comments