diff --git a/7/7.9 LAB/main.py b/7/7.9 LAB/main.py index a69aec1..9802d64 100644 --- a/7/7.9 LAB/main.py +++ b/7/7.9 LAB/main.py @@ -26,7 +26,7 @@ def save_output_keys(showdict): showdict = dict(sorted(showdict.items())) # Sort the dict by key for entry in showdict: # For every dict entry in our show dict - result += '{0}: '.format(entry) # Append a new line to represent that entry season count + result += '{0}: '.format(int(entry)) # Append a new line to represent that entry season count if isinstance(showdict[entry], list): # If the entry is a list of shows for show in showdict[entry]: # for very entry in that list of shows result += '{0}; '.format(show) # append that show, and a ";" @@ -34,7 +34,7 @@ def save_output_keys(showdict): else: # If the entry is not a list result += '{0}'.format(showdict[entry]) - with open('output_keys.txt', 'a') as f: + with open('output_keys.txt', 'w') as f: f.write(result) def save_output_titles(showdict): @@ -52,7 +52,7 @@ def save_output_titles(showdict): for item in result: # Convert list to stirng, with \n resultstring += str(item) + '\n' - with open('output_titles.txt', 'a') as f: + with open('output_titles.txt', 'w') as f: f.write(resultstring) if __name__ == '__main__':