Web Analytics

Python file.writelines() Method

File Method โ€ข Write Lines

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

Related Functions