-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.py
39 lines (28 loc) · 856 Bytes
/
utilities.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
import math
import random
from datetime import datetime
from enums import commentList,imgUrl
def createList():
list1=[]
for i in range(10):
r=random.randint(8,60)
if r not in list1: list1.append(r)
list2=[]
for i in range(10):
r=random.randint(10,30)
if r not in list2: list2.append(r)
return list1,list2
def pickCommentFromList():
r=random.randint(0,2)
print("list index is {}".format(r))
comment=commentList[r]
return comment
# datetime object containing current date and time
def CreateDbFileStr():
now = datetime.now()
print("now =", now)
# dd/mm/YY H:M:S
dt_string = now.strftime("%m_%d_%H%M")
print("date and time =", dt_string)
dt_string="pythonsqlite_"+dt_string+".db"
return dt_string