Adding Lines From A Text File And Printing Out Result Using A For Loop - Python
Problem I have a set of 50 files, which contain 8192 lines of integers (after skipping the first 12, which are irrelevant, there are also 12 more lines at the bottom which can be s
Solution 1:
Solution was to alter the lines after 'xmin = 745' as so:
xmin = 745
xmax = 815
skip = 12
for n in range(0, numfiles):
total = 0
x = np.linspace(0, 8191, 8192)
finalprefix = str(n).zfill(3)
fullprefix = folderToAnalyze + prefix + finalprefix
y = loadtxt(fullprefix + ".Spe", skiprows= xmin+skip, max_rows = xmax-xmin)
for x in y:
val = int(x)
total = total + val
print(((n+1)*MaestroT), total)
Post a Comment for "Adding Lines From A Text File And Printing Out Result Using A For Loop - Python"