Today, when I was learning learn Python's hard-ex26, there was a question about \ t, and the following are the code and the output:
1 poem = "" "2 \tthe lovely world 3 with logic so firmly planted 4 cannot discern \ n the needs of love 5 nor comprehend \ t Passion from Intuition 6 and requires a explantion 7 \n\t\twhere there is none. 8 "" 9 print "--------------" Print poem13 print "--------------"
--------------The lovely worldwith logic so firmly plantedcannot discern the needs of Lovenor comprehend passion From Intuitionand requires a explantion where there is none.--------------
As you can see, the second line of \ T and the seventh row of the two \ T are ' indented ' eight characters, and the seventh line of \ t only ' indent ' a character, then \ t is exactly how many characters (in fact, this is not true)?
To understand the problem, the code for the test is as follows:
1 print "" "2 123456789012345678901234567890123456789013 \t9\t789\t5\t\t14 1234567\t95 12345678\t76" ""
The number of the second line is to facilitate the calculation of the number of characters of the reference, run the result is as follows:
12345678901234567890123456789012345678901 9 789 5 11234567 912345678 7
You can see that Line3 's first three \ T are eight, seven, five characters, and Line4 Line5 are one and eight characters
Actually to here (although I also tested the other code, but I directly changed to the above code did not save, lazy again hit) can be roughly guessed, \ t should be eight characters for a loop, each \ t represents the current eight characters of the unit is OK, and then into the next string of eight characters of the unit
So line3 back two \ t should be indented seven and eight characters respectively, which can also explain the previous code \ t why only ' indent ' a character.
Summarize:
\ t actually ends up representing the current eight-character unit and enters into the next eight-character cell.
About \ t horizontal tab horizontal tab (tab)