My script first reads the data file and then proceeds to analyze / plot it. I want the program to read the file line from the line and then stop looking for lines to kill # in the data file, on which I want to continue it on the rest of the code (plotting / analysis, etc.) I am I have been looking around and tried for For more information .... This was originally written. This is not my thing, so I think I get errors with this format, I want to improve it and want to make # one end character. After trying the suggestion of @Love_Livetsky, I now get the error of Why does this happen? I have a new look in the range (WL) sys.exit () and
break , but they do not allow the program to continue the analytical process; Just gets out Completely lost.
For Category I (WL): if (data [i] [0] == '#'): Comments = Comments + 1 other: # Analytical stuff # More stuff
flux = np.append (flux, data [i] [1]) error: out of range index < / Pre>
: If in the '#' line: Break: #Neilles
break is what you want it will take you out of that loop where you read the lines from the file, and Whatever you read after the loop:
with open ('data') as f: for the line in f: if the line '#': break # # loop Do something else like add something to a list # data analysis O Do
No comments:
Post a Comment