Expandtabs() method in Python String Module
Expandtabs method helps to set the size of the tab (whitespace) in the string. It replaces the \t to spaces between the alphabets. This space size can be represented by tabsize as argument in expandtabs() function in the program.
Syntax:
str. expandtabs([tabsize])
tabsize is optional and the default value is 8.
Example-1:
With argument in the expandtabs([tabsize]) method
txt = "Z\tu\tr\ti\tc\th"
for i in range(2,10):
print(txt.expandtabs(i))
Output:

Example-2:
Without argument in the expandtabs() method
txt = "G\tr\ta\ts\ts"
x = txt.expandtabs()
print(x)
Output: