+ 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!!!
1 Antwort
+ 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)