By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,378 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Print python code for \t escape character?

P: 6
What is the python code for printing this sentence? "The \t is the tab escape character."
Oct 10 '10 #1
Share this Question
Share on Google+
5 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
To print a backslash character: print "\\"
Oct 11 '10 #2

P: 6
Thanks man, but I need to know how to print out that sentence so it looks the exactly same way in my script.

I want it to look like this: The \t is the tab escape character.

Whenever I do it though it looks like this:
The is the tab escape character.

Thanks for your help.
Oct 11 '10 #3

bvdet
Expert Mod 2.5K+
P: 2,851
I gave you the answer, you just did not think about it. Add a backslash in front of the tab character.

If you are in Python 3, print is a function instead of a statement.
Oct 11 '10 #4

P: 6
my fault. thank you.
Oct 11 '10 #5

bvdet
Expert Mod 2.5K+
P: 2,851
No problem. I am glad to help. :)
Oct 11 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.