+ 3

Develop a class called TextReader where t= Textreader("any file") and t.text gives the entire text as a string

im not good at object oriented programming with python..i got no idea about it..help!!!

14th Jun 2018, 2:33 PM
AISHWARYA KASTHALA
AISHWARYA KASTHALA - avatar
1 Respuesta
+ 6
class TextReader: txt = '' def __init__(self, filename): f = open(filename) self.txt = f.read() f.close @property def text(self): return self.txt t = TextReader('testfile.txt') print(t.text)
14th Jun 2018, 3:40 PM
Gopal Gautam
Gopal Gautam - avatar