What is docstring in Python? Documentation string or docstring is a multiline string used to document a specific code segment. The docstring should describe what the function or method does.