B04C-2015D – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12D-2015-B04C #PYTHON#6552    siteicon   siteicon  

Problem Statement - B04C-2015D

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)

Solution

TC++ #6552

import pickle
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()


Share

CSKC| Created: 14-Jan-2019 | Updated: 14-Jan-2019|CBSE12D-2015









Back