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

Unit III File Handling, Classes - Part4

The document provides an overview of file operations in Python, including modes for reading, writing, and appending files. It also discusses object-oriented programming concepts such as classes, objects, and key principles like inheritance and polymorphism. Additionally, it contrasts procedural and object-oriented programming in terms of various attributes like security and code reusability.

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)
10 views9 pages

Unit III File Handling, Classes - Part4

The document provides an overview of file operations in Python, including modes for reading, writing, and appending files. It also discusses object-oriented programming concepts such as classes, objects, and key principles like inheritance and polymorphism. Additionally, it contrasts procedural and object-oriented programming in terms of various attributes like security and code reusability.

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

Delete()

#example
f=open("D:/[Link]","r")
for x in f:
print (x)
-----------------------
output:
this is a appending operation in file
conti...
#delete a file
import os
[Link]("D:/[Link]")
various access modes
Mode purpose

r default mode

rb binary format

r+ reading and writing

rb+ reading and writing in binary


format
write()
mode purpose

w only for writing

wb binary format for writing


only

w+ read and write

wb+ binary format for read and


write
append()
mode purpose

a appending

ab binary format

a+ reading and append

ab+ binary format reading


and appending
Classes and objects
 Python is an object-oriented programming language
 Everything in Python is an object, with its properties
and methods
 Class definition
class ClassName: //'Optional class documentation string' class_suite
list the difference Procedural and
Object Oriented Programming
 Definition
 Security
 Method
 Division of Program
 Movement of Data
 Approach
 Inheritance
 Reusability of Code
oops concepts
 class
 object
 abstraction
 encapsultaion
 inheritance
 polymorphism
 blue print which followed by objects.
 logical structure with behavior
 object:
 instance of class
class
attributes

functions

class is logical structure object is physical entity


XYZ
student
roll_no roll
name name
write branch
read read()
write()(

You might also like