[Tutor] sqlite search syntax

Roger Shaw sk4085 at ymail.com
Fri Jan 18 21:40:48 CET 2013


Hello,  
I am very new to python. 

Wrote a small program to use on my android phone 
using pickle/shelve to access  data. 

That worked fine but i realised it would be better to use sqlite as a 
database to more easily modify the data. 

I havent got a clue about sqlite, have a book but cant find the 
answer 

My problem is this. 

I can access data by putting characters to search for 
into the program but i want it to be a variable string that i can search for.

Specificaly a couple of letters  i 
input from keypad.



At the moment this works to search for everything beginning with A  
sql = "SELECT * FROM plants WHERE genus LIKE 'A%'";  
cursor.execute(sql);  
slt =cursor.fetchone();   
What i really need is to search for everything beginning with two letters 
from an input command.

As in A is a variable that could be Bl or An or someother two letter combination


Hope you can help. 

Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130118/aed277fa/attachment-0001.html>


More information about the Tutor mailing list