0% found this document useful (0 votes)
3 views7 pages

Text File Handling

The document outlines the structure and operations of text files in Python, including how to create and manipulate them. It details various file opening modes such as read, write, and append, as well as methods for reading and writing data. Additionally, it emphasizes the use of Python functions to perform these operations effectively.

Uploaded by

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

Text File Handling

The document outlines the structure and operations of text files in Python, including how to create and manipulate them. It details various file opening modes such as read, write, and append, as well as methods for reading and writing data. Additionally, it emphasizes the use of Python functions to perform these operations effectively.

Uploaded by

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

LO: To analyze the structure of text files.

To use text file from Python. SUCCESS


To implement various operations on text files using Python.
CRITERIA
A text file is structured as a sequence of lines. To create text
Each line of text is terminated by a special character known as End files.
Of Line character.
Text files are stored in human readable form and they can also be To apply suitable
created using any text editor. python functions
on text files.
Sample text file is as follows: To implement
read and write
operations.
To differentiate
the various
opening modes.
FILE OPENING MODES
r – to open the file in read only mode
w – to open the file in write mode
r+ - to open the file in read & write mode
w+ - to open the file in write & read mode
a - to open the file in append mode
a+ - to open the file in append & read mode
TEXT FILE READ OPERATION
1. read() method
TEXT FILE READ OPERATION
2. readline() method
TEXT FILE READ OPERATION
3. readlines() method
TEXT FILE WRITE OPERATION – write()
TEXT FILE WRITE OPERATION – writelines()

You might also like