My problem is a bit hard to explain, I made a program that align the list to the longest class name, and what we see in This picture is what my program shows me when I launch it : S37 and 38 are at the same place than classes names because python goes back to line once screen border is reached.
Now, this is what I would like to have. Obviously for this case I printed it with spaces to show what it should look like, but the program has to adapt to all screen size, so this method is not viable at all. Is there any way to align all textes as they should be no matter what is the screen size ?
The exemple list i'm using (list[x][0] is the class name and list[x][1] is the class) :
[['2', ['bob', 'patrick', 'mike', 'jhamed', 'brook', 'gianni', 'espoir', 'igor', 'estère', 'charlotte', 'marie-charlotte', 'charlotte-marie', 'pénellope', 'cunégonde', 'félicie', "zo'", 'esmeralda', 'canada']], ['longclass', ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9', 'S10', 'S11', 'S12', 'S13', 'S14', 'S15', 'S16', 'S17', 'S18', 'S19', 'S20', 'S21', 'S22', 'S23', 'S24', 'S25', 'S26', 'S27', 'S28', 'S29', 'S30', 'S31', 'S32', 'S33', 'S34', 'S35', 'S36', 'S37', 'S38']], ['test2', ['S1', 'S2', 'S3', 'S4', 'S6']], ['extremely long class name', ['s1', 's2', 's3', 's4']]]
The code I use to add spaces to align (used after a program that find the biggest class name) :
for j in range(len(List)) :
var = List[j]
for i in range(length - len(List[j])) : #"length" is the number of letters in the biggest class name, with "extremely long class name" : 25
var = var + " "
print(j,length,length - len(List[j]),var,exemple)