I want to have real tabs in a print but \\t
only puts spaces.
Eg:
first:ThisIsLong second:Short
first:Short second:ThisIsLong
You can use formatting to align the strings instead. For example, you can tell python that the first column should be 20 characters long, and the second should be 10, left aligned.
For example:
string_one = 'first:ThisIsLong'
string_two = 'second:Short'
print( '{:<20s} {:<10s}'.format(string_one, string_two) )
will print:
first:ThisIsLong second:Short
The first formatting descriptor ({:<20s}
) here is saying:
'<'
left align, 20
at least 20 characters, s
because it's a string