[go: up one dir, main page]

0% found this document useful (0 votes)
25 views9 pages

Unit III File Handling , Classes_Part2

The document explains file handling in Python, including creating files, using the open function, and performing read operations. It provides examples demonstrating how to read from a file and append data to it. The examples illustrate the use of the 'open' function with different modes and the 'read' and 'write' operations.

Uploaded by

Saraswathi
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)
25 views9 pages

Unit III File Handling , Classes_Part2

The document explains file handling in Python, including creating files, using the open function, and performing read operations. It provides examples demonstrating how to read from a file and append data to it. The examples illustrate the use of the 'open' function with different modes and the 'read' and 'write' operations.

Uploaded by

Saraswathi
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
You are on page 1/ 9

what is file handling

creating file
open function
file open()
read() operation
example:
example 1
#example1
f=open("D:/test1.txt",'r')
print(f.read())
-------
output:
hello everyone welcome to python classes


example2
f=open("D:/test.txt","r")
print(f.read(5))
---------
output:
hello
append()-example
#append example
f=open("D:/test.txt","a")
print(f.write("this is a appending operation in file"))
-------------------------
output:
37

You might also like