It will return copy of string where all tab(\t) characters are replaced with spaces. If tab size not given it will assume tab size of 8 characters.
Syntax of str.expandtabs():
Below is syntax of str expandtabs in python
expandtabs(tab size=integer)
a=’weather\tis\tgood\ttoday
a.expandtabs(2)
Output: ‘weather is good today’
It will expand tab characters with 2 char spaces.as shown below
If tab size not given it will assume tab size of 8 spaces. As first Position of the tab character is 8 in given string .It fills it with 8-7=1 char spaces.2nd position of the tab char in given string is from first tab char is 2 and it has inserted 8-2=6 char spaces,3rd tab char is present at 5th position from 2nd tab char therefor It inserts 3 8-5=3 spaces of char in output.
[…] 7.Str.expandtabs:Will return copy of string in which all tab char are replaced with spaces. […]