# Python et SQLite3 problème de syntaxe

**URL:** <https://www.debian-fr.org/t/python-et-sqlite3-probleme-de-syntaxe/65978>\
**Category:** Programmation\
**Created:** [Février 21, 2016, 9:41 UTC](https://www.debian-fr.org/t/python-et-sqlite3-probleme-de-syntaxe/65978 "2016-02-21T21:41:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NuX\_o](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/8491ac/32.png) [@NuX\_o](https://www.debian-fr.org/u/NuX_o)\
**Post date:** [Février 21, 2016, 9:41 UTC](https://www.debian-fr.org/t/python-et-sqlite3-probleme-de-syntaxe/65978/1 "2016-02-21T21:41:01Z")

</div>

Bonjour,

Je me suis mis récemment à Python et SQLite3 et je rencontre le problème suivant.

```auto
sqlite> SELECT langue.nom_langue, mot.nom_mot, definition.txt_definition 
   ...> FROM "langue", "mot", "definition" 
   ...> WHERE mot.nom_mot='mot1'
   ...> AND mot.id_langue=langue.id_langue 
   ...> AND mot.id_definition=definition.id_definition;[/code]

renvoie quelque chose de correct :
[mono]langue1|mot1|def1[/mono]

Sous python :
[code]import sqlite3

conn = sqlite3.connect('dicco.db')
cursor = conn.cursor()

cursor.execute("SELECT langue.nom_langue, mot.nom_mot, definition.txt_definition FROM langue, mot, definition WHERE txt_definition='mot1' AND mot.id_langue=langue.id_langue AND mot.id_definition=definition.id_definition")
for row in cursor:
	print row[/code]

ne renvoie rien. Je n'ai pas de codes d'erreurs.
[code]------------------
(program exited with code: 0)
Press return to continue
```

Je ne comprends pas pourquoi…

Si j’enlève le " et que je les remplace par 1 " ou ’ j’ai une sortie en erreur :

Merci à vous !  
 ![:006](https://www.debian-fr.org/uploads/default/original/1X/924eb3db8bedad6a0d333b02031d3c6a9af9d9c5.gif "salut")

Après recherche, le script mis dans Python fonctionne si j’enlève les AND, le soucis c’est que j’ai besoin des ces conditions.  
 ![:017](https://www.debian-fr.org/uploads/default/original/1X/7bbea83f89515ab7c7a738dddb86c4d4f140bd13.gif "reflechit")

---

<div class="post-metadata">

**Author:** ![NuX\_o](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/n/8491ac/32.png) [@NuX\_o](https://www.debian-fr.org/u/NuX_o)\
**Post date:** [Février 21, 2016, 9:41 UTC](https://www.debian-fr.org/t/python-et-sqlite3-probleme-de-syntaxe/65978/2 "2016-02-21T21:41:02Z")

</div>

Affaire résolu… désolé je me suis planté dans un paramètre.

![:030](https://www.debian-fr.org/uploads/default/original/1X/65b1b73704eec538091c0e1d04a633b3840a284f.gif "picole")
