-
Notifications
You must be signed in to change notification settings - Fork 4
/
OpeningMessage.py
29 lines (26 loc) · 914 Bytes
/
OpeningMessage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class OpeningMessage:
"""
The OpeningMessage Class is imported by the main program
[email protected]_final_project.py. When the main program runs
a message is displayed. The methods in this class help that
message be displayed.
"""
def __init__(self, filename='files\TarotCardsIntroduction.txt'):
"""
the init method defines the filename of the file
that will be used.
"""
self.__filename = filename
def open_file(self):
"""
The open_file method opens the file defined in the init method
then returns the contents to variable msg
"""
opening_message = open(self.__filename, "r")
msg = opening_message.read()
return msg
def close_file(self):
"""
The close_file method verifies that the file gets closed
"""
open(self.__filename, "r").close()