Question: My code so far in python: for x in range (1,61): text_file = open ('template.inp_' + str (x) + '.out', r) for line in text_file:
My code so far in python:
for x in range(1,61):
text_file = open('template.inp_' + str(x) + '.out', "r")
for line in text_file:
if "1 0.0 800.0" in line:print(line)
text_file.close
text_file.close
it's output:

I need to extract the values in the box from each line and put them into a CSV file with 6 columns: column 1 = density, column 2-7 = boxed values (one column per boron value). The output data continues for 60 lines. This code is done in python.
[dancingbearl@orchard-01 ~/HW4/Prob1> (16:30:08 09/30/18) :: python pull.py I want these values Boron Density 0.0 0.1 0.0000.90057 0.89574 294.35 1.000 4.000 0.000 0.000 0.00.2 0.0001.045591.04607 198.531.000 4.000 0.0000.000 0.00.3 0.000 1.14988 1.14949 147.10 1.000 4.000 0.0000.000 0.00.4 0.0001.225071.22328 114.641.000 4.0000.0000.000 0.00.5 0.0001.281201.27833 92.39 1.0004.0000.000 0.000 0.00.6 0.0001.323851.32029 76.30 1.0004.0000.000 0.000 0.00.7 0.000 1.356751.35278 64.231.000 4.0000.0000.000 00.8 0.000 1.382181.37799 54.91 1.000 4.000 0.0000.000 0.00.9 0.000 1.402131.39788 47.541.000 4.000 0.0000.000 0.01.0 0.000 1.417761.41352 41.61 1.000 4.000 0.0000.000 0.000 0.89876 0.89380 294.05 1.000 4.000 0.000 0.000 0.000 1.03913 1.03958 198.04 1.000 4.000 0.000 0.000 0.000 1.13745 1.13725 146.53 1.000 4.0000.000 0.000 0.000 1.206021.20465 114.04 1.000 4.000 0.000 0.000 0.000 1.255251.25301 91.771.000 4.000 0.000 0.000 0.000 1.290901.28813 75.701.000 4.000 0.000 0.000 0.000 1.316781.31374 63.64 1.000 4.000 0.0000.000 1 0.0 800.0 577.0 577.0 1 0.0 800.0 577.0 577.0 1 0.0 800.0 577.0 577.0 1 0.0 800.0 577.0 577.0 1 0.0 800. 0 577.0 577.0 1 0.0 800.0 577.0 577.00. 1 0.0 800.0 577.0 577.00 1 0.0 800.0 577.0577.0 0. 1 0.0 800.0 577.0577.0 1 0.0 800.0 577.0577.0 1 0.0 800.0 577.0 577.0 400.0 1 0.0 800.0 577.0 577.0 400.0 1 0.0 800.0 577.0 577.0 400.0 1 0.0 800.0 577.0 577.0 400.0 1 0.0 800. 0 577.0 577.0 400.0 1 0.0 800. 0 577.0 577.0 400.0 1 0.0 800.0 577.0 577.0 400.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
