mutapath.Path.write_lines
- Path.write_lines(lines, encoding=None, errors='strict', linesep=<object object>, append=False)[source]
Write the given lines of text to this file.
By default this overwrites any existing file at this path.
This puts a platform-specific newline sequence on every line. See linesep below.
lines - A list of strings.
- encoding - A Unicode encoding to use. This applies only if
lines contains any Unicode strings.
- errors - How to handle errors in Unicode encoding. This
also applies only to Unicode strings.
- linesep - (deprecated) The desired line-ending. This line-ending is
applied to every line. If a line already has any standard line ending (
'\r'
,'\n'
,'\r\n'
,u'\x85'
,u'\r\x85'
,u'\u2028'
), that will be stripped off and this will be used instead. The default is os.linesep, which is platform-dependent ('\r\n'
on Windows,'\n'
on Unix, etc.). SpecifyNone
to write the lines as-is, like.writelines
on a file object.
Use the keyword argument
append=True
to append lines to the file. The default is to overwrite the file.