So i have a list of data like this:
"Load (lbf)","Time (s)","Extension (in)","Stress (ksi)","Strain (in/in)"
103.2,0.30,0.008,1.160,0.00228
172.4,0.50,0.009,1.939,0.00246
241.8,0.70,0.010,2.718,0.00264
311.2,0.90,0.010,3.500,0.00282...
What I am essentially trying to do is convert it to a tab separated table such that it can be copy-pasted into origin or excel. The plan to do this is read each column into an array and write it back with tabs as separation. The trouble is I have little formal training in writing code and I haven't done it in a few months, so reading around on SE isn't particularly helpful(its rare that people explain what their code does line by line.) What I'm running into is reading the data doesn't seem to want to play. I've tried:
file=str(input("enter filepath: "))
hdr=int(input("enter number of lines before data: "))
def read(file, convert=float, sep=","):
with open(file) as f:
for i in range(hdr):
next(f)
for line in f:
load.append(col[1])
As well as:
file=str(input("enter filepath: "))
hdr=int(input("enter number of lines before data: "))
def read(file, convert=float, sep=","):
with open(file) as f:
for i in range(hdr):
next(f)
for line in f:
extension.append[convert(line.split(sep=',')[3]) for line in f]
There are no errors thrown, but it simply does nothing. any tips would be greatly helpful.
readin your script? you only just defined the function.