Python String expandtabs() Method
Replaces tab characters in a string with the specified number of whitespaces.
Syntax
Python
Copy Code
string.expandtabs(tabsize = 8)
Parameters
Parameter | Description |
---|---|
tabsize |
Optional. The tab size in spaces. The default is 8 |
Example
Python
Copy Code
print('a\tb\tc'.expandtabs(20))
Output
a b c