Skip to tool

Python str.partition() Online

Return three values by splitting at the first occurrence of a separator.

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

Worked example

The three values are the text before the separator, the separator, and the text after it. If the separator is absent, the original text is first.

Separator
"/"
Sample input
manuals.plus/docs
Sample output
["manuals.plus","/","docs"]

Python example

print("manuals.plus/docs".partition("/"))
Expected native output
('manuals.plus', '/', 'docs')

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