expandtabs() function in python by R4R Team

-expandtabs() is a python function which expand the size of the tab
-t is the symbol which are used to add the tab in the string.

Syntax -
string.expandtabs(size)

program-

s="Myttext"
print("Original string is ",s)
print("Defualt expandtabs ",s.expandtabs())
print("16 expandtabs ",s.expandtabs(16))


output-

Original string is My text
Defualt expandtabs My text
16 expandtabs My text


-In this program, we have a string s="myttext", here t is a tab and we print the string with default tab but in other expandtabs(16) we increase the size of tab so the text 'my' and 'text' are seprated by more space.

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!