Why do I see output only if I put space.
print "I love you %s" % "\tI'm tabbled in."
print "I love you %s" % " \tI'm tabbled in."
output
I love you I'm tabbled in.
I love you I'm tabbled in.
Escape sequences allow you to include special characters in strings. To do this, simply add a backslash ( \ ) before the character you want to escape.
How to escape the parentheses ( and ) in Python regular expressions? Parentheses have a special meaning in Python regular expressions: they open and close matching groups. You can get rid of the special meaning of parentheses by using the backslash prefix: \( and \) .
Typically, \t (TAB) goes to the next tab stop - it is not a synonym for "n spaces".
I love you XI'm tabbled in.
I love you XXXXI'm tabbled in.
0---1---2---3---4---
The current terminal is configured with a tab stop size of 4 which is shown on the bottom. The "X" are the characters skipped by the tab.
So the first line skips one character with the tab (it goes to tab stop #3) and the second line writes a space and then skips four characters (to get to tab stop #4).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With