On one hand,I am writing a script which decompose words in syllabs. The result is a list of variables éléments called cod1.
On the other hand, i have a mysql base ('décodeur') and a table 'codon' which contains a colunn of syllab called semes) and another one which contains the supposed significance of the syllab(called sens).
I thought a sql query could successicely "read" the élements of the list cod1 and search them in the column 1 in order to give the sense written in the second column.
But the query I wrote don't do the job and only catch the last syllab of cod1 and its sense.
Is it possible to make a query iterating on the elements of a list when we don't know in advance the number of the elements of this list? (the same syllab can be appear several times in the same word)
Who can help me?
try:
sql=("""SELECT semes, sens1 FROM codons WHERE semes = %s""")
k.execute(sql, (cod1,))
reponse = k.fetchall()
for x in reponse:
print(x)
except:
pass
if conn:
conn.close()
I am with python 2.7 and mysql connector Thanks for your answer