I'm making a hangman game to get more familiar with Python, and I decided to implement reading text files to get death messages etc. Since I added this sub program, the program closes as soon as this sub program is called.
def life_loss_messages_create():
p_life_loss_messages = []
life_loss_messages_file = open("life_loss_messages.txt", "r")
for message_line in life_loss_messages_file:
message_line.strip()
this_line = message_line.split("-")
p_life_loss_messages.append(this_line)
life_loss_messages_file.close()
return p_life_loss_messages
Why will this not run past this sub program outside of IDLE? If opened and ran with IDLE it works fine, but not if double clicked and ran itself.