-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·41 lines (36 loc) · 1.19 KB
/
Copy pathmain.py
File metadata and controls
executable file
·41 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python3
import sqlite3
import os
import sys
conn = sqlite3.connect('data.db')
c = conn.cursor()
def sportEqResearch(eq, numLib):
if numLib == 0:
req = "select ComLib, EquNom from equipement where EquNom like '%" + eq + "%';"
else:
req = "select ComLib, EquNom from equipement where EquNom like '%" + eq + "%' and ComInsee like '" + str(numLib) + "%';"
c.execute(req)
row = c.fetchone()
while row is not None:
print(row)
row = c.fetchone()
def sqlRequest(req):
c.execute(req)
row = c.fetchone()
while row is not None:
print(row)
row = c.fetchone()
os.system('clear')
choice = ""
while choice != exit:
choice = input("What do you want to do ? \n - req to find an equipement sportif \n - devMode to dev mode \n\n")
if choice == "req":
eq = input("What's the name of the equipement sportif that you want to find ? \n")
numLib = input("Departement : (0 : all departements)\n")
sportEqResearch(eq, int(numLib))
elif choice == "devMode":
req = input("Type your SQL select request : \n")
sqlRequest(req)
if choice == "exit":
os.system('clear')
sys.exit(0)