I run this code in a loop with different length of father[0] value each time. All works well but sometimes it pops the error "String index out of range"
for a in range(len(father[0])):
column = [item[a] for item in father]
I run this code in a loop with different length of father[0] value each time. All works well but sometimes it pops the error "String index out of range"
for a in range(len(father[0])):
column = [item[a] for item in father]
Just put a checker for empty string before you jump into the loop. Mind empty strings as they may throw the exception you're currently facing.
>>> empty_string = ''
>>> empty_string[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
You might want to see, what values you are passing to father[0], as mentioned by @Devrim above it could be the string is empty.