Python String expandtabs() method

The string.expandtabs() method in Python returns a copy of the string where all tab characters are expanded using spaces.

Syntax

Parameter

tabsize: This parameter specifies the number of characters to be replaced for a tab character ‘\t’.

Return

This method returns a copy of the string where all tab characters are expanded using spaces.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This