Question: a Python class that meets the following specifications: It has a class docstring It has an __init__() method that takes a file name as a
a Python class that meets the following specifications:
- It has a class docstring
- It has an __init__() method that takes a file name as a parameter and stores it as an attribute
- It has a read() method that reads the file named in the attribute and returns the contents of the file
- It contains a method docstring
- It uses a with statement to open the file for reading
- Assume the file is a plain text file in UTF-8 encoding
- At the end of the script (and outside of your class), if __name__ == "__main__": statement in which you instance of your class and invoke the instance's read() method
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
