I have a nested list that contains lists filled with strings. What I'm trying to do is make each list in this slot the same length as the longest available list in this slot. It sounds simple, but my attempts failed (I am completely new to programming), and I cannot find an answer that is resolved enough to solve my problem.
First, I determine how long the list is long:
maxSS7 = max(len(i) for i in ssValues7))
Then I use the for loop to expand each list by a specific number of "null" if it is not the same length as the longest list:
for row in ssValues7: if row < len(maxSS7): row.extend(['null' * (len(maxSS7) - len(row))])
I am expanding the string to 'null' * the difference between the longest list and the current list. No errors occur, but unfortunately it does nothing for my nested list.
Can someone please enlighten me regarding my mistake? Any help would be greatly appreciated.
source share