0% found this document useful (0 votes)
8 views

Writing the Data to the File

The document explains how to write data to a file using two pre-defined functions in TextIOWrapper: write() and writelines(). The write() function is used for writing string data, while writelines() is used for writing iterable objects. Both functions write data to the file value by value.

Uploaded by

Godspell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Writing the Data to the File

The document explains how to write data to a file using two pre-defined functions in TextIOWrapper: write() and writelines(). The write() function is used for writing string data, while writelines() is used for writing iterable objects. Both functions write data to the file value by value.

Uploaded by

Godspell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

===================================================

Writing the Data to the File


===================================================
=>After Opening the File in any of the write modes, we must write the data to the
file.
=>To write the data to the file, we have 2 Pre-Defined Functions present in
TextIOWrapper. They are

1. write()
2. writelines()
-----------------------------------------------------------------------------------
------------------------------------------------------------
1. write()
-----------------------------------------------------------------------------------
------------------------------------------------------------
=>Syntax: varname=filepointerobj.write(strdata)
=>This Function is used for writing any type of data to the file in the form of
str.
-----------------------------------------------------------------------------------
------------------------------------------------------------
2. writelines()
-----------------------------------------------------------------------------------
------------------------------------------------------------
=>Syntax: varname=filepointerobj.writelines(Iterable-object)
=>This Function is used for writing any type of Iterable object data to the file in
the form of str.
-----------------------------------------------------------------------------------
------------------------------------------------------------
NOTE: Here write() and writelines() will write any type of data to the file in the
form of Value by Value.

You might also like