-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e11a86
commit dfa48ea
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import csv | ||
import time | ||
|
||
curDT = (str(round(time.time_ns()))) | ||
|
||
curfile = "./data/datafile"+curDT+".csv" | ||
|
||
class CurCSV: | ||
This comment has been minimized.
Sorry, something went wrong. |
||
def __init__(self,file,data=str): | ||
self.file = file | ||
self.data = data | ||
try: | ||
with open(self.file, 'x') as f: | ||
pass | ||
with open(self.file, "a") as CSVfile: | ||
writer = csv.writer(CSVfile) | ||
writer.writerow(['Time','Subject','Body','Notes']) | ||
except: | ||
pass | ||
def __str__(self): | ||
return "File is" + self.file | ||
def readFile(self): | ||
print("\nFile Contents:\n-----Start of File-----") | ||
with open(self.file, "r+") as CSVfile: | ||
reader = csv.reader(CSVfile) | ||
for row in reader: | ||
print(', '.join(row)) | ||
print("-----End of File----\n") | ||
def printCurFile(self): | ||
print("File accessed at " + self.file) | ||
return self.file | ||
def writeFile(self, time, subj, body, notes): | ||
global timeStepper | ||
if self.data == None: | ||
print("No data provided.") | ||
elif self.data == str: | ||
with open(self.file, "a") as CSVfile: | ||
writer = csv.writer(CSVfile) | ||
writer.writerow([time,subj,body,notes]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This wont be the only class by a long shot, but it does give a good idea for my plan. A class for the SimConnect api for example. Then call it with args about what flight param I want and boom