Thursday, May 24, 2012

Select from SQLite Database using Python return records that start with a Character

import re
import sqlite3

#----------------setup database
conn = sqlite3.connect('h:\\Python\\ReadWord\\readword.sqlite')
c = conn.cursor()

# Do this instead
#t = (symbol,)
c.execute('''SELECT * FROM uniquephrase WHERE match_text_sum LIKE "a%" ''')

for row in c:
        waitForInput = input('--> ')
        print(row)

# Save (commit) the changes
#conn.commit()
# Close db before too many connections
c.close()



No comments:

Post a Comment