☰
✕
  • NCERT Classes
    • Class 7
    • Class 8
    • Class 9
    • Class 10
    • Class 11
    • Class 12
  • Previous Year Papers
    • CBSE Class 10 and 12
    • NEET Class 12
    • IIT JEE-Main Class 12
    • ICSE Class 10 and 12
    • CLAT Class 12
  • Entrance Exams
    • IIT-JEE
    • NEET
    • CLAT
    • SSC-CGL
    • SSC-CHSL
  • State Boards
    • Assam Board
    • UP Board English Medium
    • UP Board Hindi Medium
    • CBSE Board English Medium
    • CBSE Board Hindi Medium
    • Uttarakhand Board Hindi Medium
    • Manipur Board
    • Goa Board
    • Gujrat Board
    • Haryana Board English Medium
    • Haryana Board Hindi Medium
    • Uttarakhand Board English Medium
    • Himachal Board English Medium
    • Himachal Board Hindi Medium
    • ICSE Board
    • Jharkhand Board English Medium
    • Jharkhand Board Hindi Medium
    • Karnataka Board
    • Meghalya Board
    • Nagaland Board
    • Punjab Board
    • Rajasthan Board English Medium
    • Rajasthan Board Hindi Medium
  • Wired Faculty
  • Data File Handling

Data File Handling

Question
CBSEENCO12011694
Wired Faculty App

Differentiate between the following:

  1. f = open(‘diary.txt’, ‘r’)
  2. f = open(‘diary.txt’, ‘w’)

Answer
Short Answer

  1. diary.txt is opened for reading data.
  2. diary.txt is opened for writing data.

Sponsor Area

Some More Questions From Data File Handling Chapter

Write a method in python to read the content from a text file diary.txt line by line and display the same on screen.

Consider the following definition of class Member, write a method in python to write the content in a pickled file member.dat.

class Member:
	def_init_(self,Mno,N) :
	self.Memno=Mno
	self.Name=N
	def Show(self):
		Display (self.Memno, '#',self.Name)
	def store_data(self):
		piFile = open('member.dat','wb')
		pickle.dump(self, piFile)
		piFile.close()

Mock Test Series

Sponsor Area

  • NEET Mock Test Series
  • IIT-JEE Mock Test Series
  • CLAT Mock Test Series
  • SSC-CGL Mock Test Series
  • SSC-CHSL Mock Test Series

NCERT Book Store

  • CBSE Class 7
  • CBSE Class 8
  • CBSE Class 9
  • CBSE Class 10
  • CBSE Class 11
  • CBSE Class 12

NCERT Sample Papers

  • CBSE English Medium
  • CBSE Hindi Medium
  • ICSE

Sponsor Area

Entrance Exams Preparation

  • NEET
  • IIT-JEE
  • CLAT
  • SSC-CGL
  • SSC-CHSL

About Us

  • Company

  • Term of Use

  • Privacy Policy

NCERT Solutions

  • NCERT Solutions for Class-7th

  • NCERT Solutions for Class-8th

  • NCERT Solutions for Class-9th

  • NCERT Solutions for Class-10th

  • NCERT Solutions for Class-11th

  • NCERT Solutions for Class-12th

Contact us

  • address A2/44 Sector-3 Rohini Delhi 110085
  • phone+91 8076753736
    +91 9953425779
  • Emailsupport@wiredfaculty.com
©2025 Wiredfaculty.