Python string expandtabs()
method returns a copy of a string, tab
character. Expansion spaces ' \t
', optionally using a given tab size - tabize
(default value 8
).
grammar:str.expandtabs(tabsize = 8)
Returns: This method returns a copy of a string, use the space expands, " \t
" character.
Example: The following example shows expandtabs()
the use of the method.
>>>s = "a\tbcd\tefg\n1\t23400000000000000000000\t567" >>>print(s) a bcd efg 1 23400000000000000000000 567 >>>print(s.expandtabs()) a bcd efg 1 23400000000000000000000 567 >>>print(s.expandtabs(20)) a bcd efg 1 23400000000000000000000 567 >>>print(s.expandtabs(30)) a bcd efg 1 23400000000000000000000 567