May-19-2018, 04:53 AM
I have 2 for loops that fetch data from 2 different data sources, one for loop prints an output of 15 rows and 6 columns and another for loop prints an output of 18 rows and 6 columns like below , sample output
For loop 1 output:
![[Image: for1.png]](https://s9.postimg.cc/5qoncgs0r/for1.png)
For loop 2 output:
![[Image: for_2.png]](https://s9.postimg.cc/8xj6w5hmj/for_2.png)
i want them to be combined and organised in such a way that they are sorted based on column 6 with the column1 of for loop 1's output is fixed as follows,
![[Image: expected.png]](https://s9.postimg.cc/jkd01q2ob/expected.png)
How can i organize the output from these 2 for loops to create this output. i am not sure where to start, however i tried creating individual lists by appending the output that i get from the for loop and it throws an error that it can accept only one argument as below
What should be done to make this work
For loop 1 output:
![[Image: for1.png]](https://s9.postimg.cc/5qoncgs0r/for1.png)
For loop 2 output:
![[Image: for_2.png]](https://s9.postimg.cc/8xj6w5hmj/for_2.png)
i want them to be combined and organised in such a way that they are sorted based on column 6 with the column1 of for loop 1's output is fixed as follows,
![[Image: expected.png]](https://s9.postimg.cc/jkd01q2ob/expected.png)
How can i organize the output from these 2 for loops to create this output. i am not sure where to start, however i tried creating individual lists by appending the output that i get from the for loop and it throws an error that it can accept only one argument as below
io = [] for obj in hearts: rawvalue = obj.raw - readvalue if rawvalue < 0: rawvalue = rawvalue + 440 else: rawvalue obj = str(obj) obj = ((obj.strip('<').split(" ")[0])) io.append(obj, viewdata(rawvalue)[0][3],viewdata(rawvalue)[0][0], viewdata(rawvalue)[0][1], viewdata(rawvalue)[0][2],rawvalue)
Quote:TypeError: append() takes exactly one argument (6 given)
What should be done to make this work