Skip to main content

normalize_eols

Take a block of raw text that will be passed through str.splitlines() to get universal newlines treatment.

Return the resulting block of text with normalized \n EOL sequences ready to be written to disk using current platform's native EOLs.

def normalize_eols(
raw_contents: string
) - > string

Take a block of raw text that will be passed through str.splitlines() to get universal newlines treatment. Return the resulting block of text with normalized \n EOL sequences ready to be written to disk using current platform's native EOLs.

Parameters

NameTypeDescription
raw_contentsstringThe block of raw text containing inconsistent or platform-specific end-of-line characters to be normalized.

Returns

TypeDescription
stringThe resulting block of text with normalized \n EOL sequences, including a trailing newline if the input was not empty.