Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active December 8, 2017 13:50
Show Gist options
  • Select an option

  • Save BlogBlocks/f9803ed3c1e5cce78eeb116baf7a0629 to your computer and use it in GitHub Desktop.

Select an option

Save BlogBlocks/f9803ed3c1e5cce78eeb116baf7a0629 to your computer and use it in GitHub Desktop.
def dbread():
import sqlite3
conn = sqlite3.connect('XPfts4.db')
c = conn.cursor()
count = 0
req = 100
view = raw_input("Search : ")
for row in c.execute('SELECT rowid, code FROM pages WHERE pages MATCH ?', (view,)):
count=count+1
print (row)[0],"-",(row)[1],"\n"
if count > req:
conn.close()
sys.exit()
@BlogBlocks

Copy link
Copy Markdown
Author

Use to do a quick DB read with raw_input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment