Class with multiple data inputs
<p>New to utilizing classes.</p>

<p>If I have 3 different files as such:</p>

<pre><code>#test1.txt:
a 100 xxx
b 200 fff
a 200 xxx
c 500 fff
a 200 www

test2.txt:
123 msg1 data2
123 msg1 data3
125 msg1 data2
123 msg2 data5
128 msg3 data2

test3.txt:
jan 5 79
jan 5 80
dec 5 79
dec 12 79
feb 5 80
</code></pre>

<p>and I want to populate all the data in 1 class while iterating through the files, is this the right approach?</p>

<p>I am having difficulty figuring out how to populate all of the data without overwriting and extracting based upon any single parameter.</p>

<pre><code>class DInput:
    def set_f0(self, f0):
        self.f0=f0
        self.f1,f2,f3,f4,f5,f6,f7,f8=[]
    def add_f1(self, f1):
        self.f1.append(f1)
    def add_f2(self, f2):
        self.f2.append(f2)
    def add_f3(self, f3):
        self.f3.append(f3)
    def add_f4(self, f4):
        self.f4.append(f4)
    def add_f5(self, f5):
        self.f5.append(f5)
    def add_f6(self, f6):
        self.f6.append(f6)
    def add_f7(self, f7):
        self.f7.append(f7)
    def add_f8(self, f8):
        self.f8.append(f8)  

call = DInput() 

with open('test1.txt','r') as file1, open('test2.txt','r') as file2, open('test3.txt','r') as file3:
    for line in file1:
        f0,f1,f2=line.split()
        call.set_f0(f0)
        call.add_f1(f1)
        call.add_f2(f2)
    for line in file2:
        f3,f4,f5=line.split()
        call.add_f3(f3)
        call.add_f4(f4)
        call.add_f5(f5)
    for line in file3:
        f6,f7,f8=line.split()
        call.add_f6(f6)
        call.add_f7(f7)
        call.add_f8(f8)
</code></pre>
