Parse Multiple Files using Python and Write Data to a Single File
<p>I am new to Python programming and I am trying to parse multiple files and get the data from each file and write it to a single file. The one file I would like to create the data just has a unique data based upon the primary keys and its associated data (similar to how we create the pivot table in excel). I am attaching the sample text file. All the text files has three sections and each section will be parsed to a separate text file.</p>

<pre><code>Test Data 123

Section1
PrimaryKey  Primary Key2    Primary Key3    TestData1   TestData2   TestData3
Key1        Data1       Sample1     119     100     0.920336134
Key1        Data2       Sample2     120     101     0.921666667
Key1        Data3       Sample3     115     96      0.914782609
Key2        Data1       Sample1     77      58      0.833246753
Key2        Data2       Sample2     66      47      0.792121212
Key3        Data1       Sample1     106     87      0.900754717

Section2
PrimaryKey  Primary Key2    Primary Key3    TestData1   TestData2   TestData3   TestData4   TestData5   TestData6
Key1        Data1       Sample1     119     100     0.856       0.859       0.862       0.865
Key1        Data2       Sample2     120     101     0.876       0.879       0.882       0.885
Key1        Data3       Sample3     115     96      0.896       0.899       0.902       0.905
Key2        Data1       Sample1     77      58      0.916       0.919       0.922       0.925
Key2        Data2       Sample2     66      47      0.936       0.939       0.942       0.945
Key3        Data1       Sample1     106     87      0.956       0.959       0.962       0.965
Key1        Data1       Sample1     116     97      0.976       0.979       0.982       0.985
Key1        Data2       Sample2     101     82      0.996       0.999       1.002       1.005
Key1        Data3       Sample3     106     87      1.016       1.019       1.022       1.025
Key2        Data1       Sample1     61      42      1.036       1.039       1.042       1.045

Section3
Column1 Column2
Test1   DataTest
Test2   DataTest1
Test3   DataTest2
Test4   DataTest3
Test5   DataTest4
Test6   DataTest5
Test7   DataTest6
Test8   DataTest7
</code></pre>
