Skip to tool

Python str.expandtabs() Online

Expand tabs to the next tab stop, as Python str.expandtabs() does.

The output updates as you type. The tool processes input in your browser.

Worked example

A tab advances to the next tab stop. A line break resets the column used to calculate the following tab.

Tab size
4
Sample input
a	b	c
Sample output
a   b   c

Python example

print("a\tb\tc".expandtabs(4))
Expected native output
a   b   c

Using this operation in Python

The interactive result uses JavaScript. Python str stores Unicode text. Encode to bytes when an API expects UTF-8 or another byte representation.

Python reference