-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathresults.py
executable file
·43 lines (32 loc) · 1.05 KB
/
results.py
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
42
43
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 11:07:47 2019
@author: edoardottt
"""
import sqlite3
from datetime import datetime
def save(missili, bombe, nemici):
conn = sqlite3.connect("result.db")
timenow = datetime.now()
c = conn.cursor()
c.execute("INSERT INTO match VALUES(?,?,?,?)", (timenow, missili, bombe, nemici))
conn.commit()
c.execute("SELECT missili,bombe,nemici FROM match WHERE date=?", (str(timenow),))
c.execute("SELECT MAX(missili) FROM match")
bold = str(c.fetchone())
bold = bold.replace("(", "")
bold = bold.replace(")", "")
b = bold.replace(",", "")
c.execute("SELECT MAX(bombe) FROM match")
aold = str(c.fetchone())
aold = aold.replace("(", "")
aold = aold.replace(")", "")
a = aold.replace(",", "")
c.execute("SELECT MAX(nemici) FROM match")
dold = str(c.fetchone())
dold = dold.replace("(", "")
dold = dold.replace(")", "")
d = dold.replace(",", "")
conn.commit()
conn.close()
return [a, b, d]