I know the title looks odd but I am going to explain it.
Say I will obtain a list from the user with n number of rows and j number of columns. Then, I will have n x j sized list in my database.
I will ask for another list from the user. It can be any size because my code will convert it to a 1 row and k column sized list.
I want to append the second list to the n x j list by converting the second list column number to j.
For example, the user sent the first list as below:
list1 = [[Column1, Column2], [1 , 2], [3 , 4]]
And the user sent the second list, and my code converted it to 1 x n sized list:
list2 = [5 , 6 , 7 , 8 , 9 , 10]
What I want is:
list1 = [[Column1, Column2], [1 , 2], [3 , 4], [5 , 6], [7 , 8], [9 , 10]]
My code perfectly finds the column number of the first list. The problem is converting the second list to paired list of lists in which every internal list is first_list_column_number
sized. The first_list_column_number
should stay there due to the scalability of the code.
I tried below method but it is not working and I couldn't find any help from the sources.
for i in range(len(list2)):
for j in range(first_list_column_number)
list1.append(list2[j])
But it only creates the same integers repeating. It is also not creating list of lists as I wanted.
Any help is appreciated.