Converts all characters in a text file to lowercase, then writes the result into
text_lower
text_lower.text_lower(input_path, output_path)
Converts all characters in a text file to lowercase, then writes the result into another file. If empty input file is provided, it will create an empty output file.
Parameters
Name
Type
Description
Default
input_path
str
Path to the input text file. Must be a string ending with .txt
required
output_path
str
Path to write the processed text file. Must be a string ending with .txt. If input and output paths are the same, the input file will be overwritten.
required
Returns
Name
Type
Description
None
Function writes directly to a UTF-8 file and returns None.
Raises
Name
Type
Description
TypeError
If input_path or output_path is not a string.
ValueError
If input_path or output_path does not have a .txt file extension.
FileNotFoundError
If the input file does not exist.
OSError
If there is an error reading from or writing to the file.
Examples
>>> text_lower("example.txt", "example_lower.txt")# example_lower.txt contains the contents of example.txt, but with all# instances of uppercase characters replaced with lowercase equivalents