forked from deepmatrix/fishing_gadget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiFishLog.py
28 lines (23 loc) · 867 Bytes
/
PiFishLog.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
import csv
while True:
operation = raw_input("\nEnter an operation. F = add fish, L = view log, and E = end.: ")
if operation == 'F':
species = raw_input("\nSpecies?: ")
weight = raw_input("Weight?: ")
length = raw_input("Length?: ")
temp = raw_input("Air temp?: ")
baro = raw_input("Barometric pressure?: ")
humid = raw_input("Humidity?: ")
appendMe = str('\n'+species+','+weight+','+length+','+temp+','+baro+','+humid)
appendFile = open('log.csv', 'a')
appendFile.write(appendMe)
appendFile.close()
elif operation == 'L':
with open('log.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
print(row)
elif operation == 'E':
break
else:
print ('\nInvalid operation')