Function Details: writelines

Description


Write a list of lines to the stream. Line separators are not added.


Extended Description


The writelines() method writes a sequence of strings to the file. Unlike its name might suggest, it doesn't add line separators automatically. If you want each string to be on a new line, you need to add the newline characters yourself. This method is more efficient than calling write() multiple times for a sequence of strings.


Function Signature



Module: io

Class: TextIOWrapper

Parameters



Parameter List


  • lines: List[str]

Return


This method doesn't return a value.


Return Type


None

Output

Explanation

This example demonstrates the basic usage of writelines(). It writes a list of strings to the file, each ending with a newline character.