summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinternetlandlord <f.fredhenry@gmail.com>2022-10-12 21:26:02 +0000
committerinternetlandlord <f.fredhenry@gmail.com>2022-10-12 21:26:02 +0000
commitce47e85fc9a958bbe872c2f58da1d5e99219e0a6 (patch)
treebcf57864e0c512f43f7433d22b61fa49bf3f4058
parent2163bfa4f62dceada7c4383f29844642051e8f9d (diff)
Added a third function to i/o py - egress (no generation, just writing to file)
-rwxr-xr-xinputoutput.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/inputoutput.py b/inputoutput.py
index bd38690..da22d12 100755
--- a/inputoutput.py
+++ b/inputoutput.py
@@ -19,12 +19,26 @@ def ingressCSV(location):
numlist.append(int(row[col]))
return numlist
+# ---------- CSV Egress Function
+# Takes two input arguments:
+# List to write to file (the "row")
+# Path of file to write to (location)
+#
+# No returned value(s), only closes a file
+
+def egressCSV(row,location):
+ f = open(location,'w')
+ writehead = csv.writer(f)
+
+ writehead.writerow(row)
+ f.close()
+
# ---------- CSV Generate Function
# Takes three input arguments:
# How many numbers (span)
# Range of numbers (limit)
# Path of file to write to (location)
-#
+#
# No returned function value, but random numbers
# are generated in a row and written to a CSV
@@ -39,6 +53,8 @@ def generateCSV(span,limit,location):
writehead.writerow(row)
f.close()
+# ---------- Debugging Below Here
+
# Sanity check
#print("Calling generateCSV function:\n\n")
#generateCSV(10,100,'./test.csv')
@@ -46,3 +62,6 @@ def generateCSV(span,limit,location):
#print("Calling ingressCSV function:\n")
#numdata = ingressCSV("./test.csv")
#print("Result:\n{}".format(numdata))
+
+#lateral = [8,6,7,5,3,0,9]
+#egressCSV(lateral,"./guggis.csv")