Why does printing a tabulator not always print a tabulator but a space?
Question:
this might be a simple question but I haven’t found a solution or a similar question yet.
When printing
print(str(n) + "t" + str(abs(moved_nm.value)) + "t" + str(truncate(diff_2, 2)) + "t" + str(truncate(diff_abs, 2)))
It prints
3 9999375 9935347.98 64027.01
Why does the first t print a tabulator while the rest don’t?
Answers:
It actually does print tabulators. The ASCII code of your string is:
51 9 57 57 57 57 51 55 53 9 57 57 51 53 51 52 55 46 57 56 9 54 52 48 50 55 46 48 49
(you can check here)
The code for tabulator is 9
and your string contains 3 of them, 1 between each word.
Note that a tabulator does not always appear to have the same length, it adjusts the length to get to the beginning of the next column. It is useful in case you want a column that starts at the same position at each line, but be careful to not allow to long words or it will expand until the next column beginning.
this might be a simple question but I haven’t found a solution or a similar question yet.
When printing
print(str(n) + "t" + str(abs(moved_nm.value)) + "t" + str(truncate(diff_2, 2)) + "t" + str(truncate(diff_abs, 2)))
It prints
3 9999375 9935347.98 64027.01
Why does the first t print a tabulator while the rest don’t?
It actually does print tabulators. The ASCII code of your string is:
51 9 57 57 57 57 51 55 53 9 57 57 51 53 51 52 55 46 57 56 9 54 52 48 50 55 46 48 49
(you can check here)
The code for tabulator is 9
and your string contains 3 of them, 1 between each word.
Note that a tabulator does not always appear to have the same length, it adjusts the length to get to the beginning of the next column. It is useful in case you want a column that starts at the same position at each line, but be careful to not allow to long words or it will expand until the next column beginning.