Hi,
I'm starting an online Python class and have been using Python 3 latest with IDLE. I open Python first then open IDLE next to it. Well, I got to the section using the newline and tab characters when printing strings. Then noticed something peculiar on the output. IDLE is configured to treat tabs as 4 spaces, but when the print command runs a string with the \t in it, it shows 8 spaces on the output.
Thank you for helping in demystifying this issue.
I'm starting an online Python class and have been using Python 3 latest with IDLE. I open Python first then open IDLE next to it. Well, I got to the section using the newline and tab characters when printing strings. Then noticed something peculiar on the output. IDLE is configured to treat tabs as 4 spaces, but when the print command runs a string with the \t in it, it shows 8 spaces on the output.
print("Line 1\n\tLine 2")Output comes out like this:
Output:Line 1
Line 2
Instead of this:Output:Line 1
Line 2
The first thing I did was check IDLE's tab stop configuration and it was already set to 4 spaces. I changed it to 2 spaces but the output still shows 8 spaces.Thank you for helping in demystifying this issue.