Python file.writelines() Method
The writelines() method writes the items of a list to the file.
Where the texts will be inserted depends on the file mode and stream position.
Syntax
file.writelines(list)
Parameters
| Parameter | Description |
|---|---|
list |
Required. The list of texts to be written. |
Return Value
None.
Example
Using the writelines() method:
Output
Click Run to execute your code
Enjoying these tutorials?