Path.lines(encoding=None, errors=None, retain=True)[source]

Open this file, read all lines, return them in a list.

Optional arguments:
encoding - The Unicode encoding (or character set) of

the file. The default is None, meaning use locale.getpreferredencoding().

errors - How to handle Unicode errors; see

open for the options. Default is None meaning “strict”.

retain - If True (default), retain newline characters,

but translate all newline characters to \n. If False, newline characters are omitted.

See also