-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.py
44 lines (30 loc) · 1.09 KB
/
session.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
44
import csv
DELIMITER = ' '
QUOTECHAR = '|'
def get():
try:
with open('session.csv', newline='') as csvfile:
sreader = csv.reader(csvfile, delimiter=DELIMITER, quotechar=QUOTECHAR)
return sreader
""" out = []
for row in spamreader:
#print(', '.join(row))
out.append(row)
return out """
except:
print("No session file")
return []
def add(newrow):
with open('session.csv', 'a', newline='') as csvfile:
seswriter = csv.writer(csvfile, delimiter=DELIMITER,quotechar=QUOTECHAR, quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(newrow)
def sessionTest():
with open('session.csv', 'a', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=DELIMITER,quotechar=QUOTECHAR, quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(['test',0,0,0,0,'none'])
#spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
#spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
test = get()
for row in test:
print(row)
#sessionTest()