Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about how to print tab in python. so without wasting time lets learn about of this.
How to print tab in python
print tab in python
to print tab in python just Use \t . By using \t you can print a tab in python. It is very easy way to do it. Lets learn about of this by given below example:
print("Hello\tguys")
Output :Hello guys
How to print tab in python
to print tab in python just Use list . By using list you can print a tab in python. It is very easy way to do it. Lets learn about of this by given below example:
mylst = ['burger','pizza','dhosa'] print (str(mylst[0]) + "\t" + str(mylst[1]) + "\t" + str(mylst[2]))
Output :burger pizza dhosa
t in python
to print tab in python just Use list . By using list you can print a tab in python. It is very easy way to do it. Lets learn about of this by given below example:
mylst = ['burger','pizza','dhosa'] print (str(mylst[0]) + "\t" + str(mylst[1]) + "\t" + str(mylst[2]))
Output :burger pizza dhosa
Method 1: Use \t
By using \t you can print tab. It is very easy way to do it. Lets learn about of this by given below example:
print("Hello\tguys")
Output :
Hello guys
Method 2: Use list
By using list you can print a tab. It is very easy way to do it. Lets learn about of this by given below example:
mylst = ['burger','pizza','dhosa']
print (str(mylst[0]) + "\t" + str(mylst[1]) + "\t" + str(mylst[2]))
Output :
burger pizza dhosa
Conclusion
It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?
Also, Read