week-7 #9
|
@ -26,7 +26,7 @@ def save_output_keys(showdict):
|
||||||
showdict = dict(sorted(showdict.items())) # Sort the dict by key
|
showdict = dict(sorted(showdict.items())) # Sort the dict by key
|
||||||
|
|
||||||
for entry in showdict: # For every dict entry in our show dict
|
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
|
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
|
for show in showdict[entry]: # for very entry in that list of shows
|
||||||
result += '{0}; '.format(show) # append that show, and a ";"
|
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
|
else: # If the entry is not a list
|
||||||
result += '{0}'.format(showdict[entry])
|
result += '{0}'.format(showdict[entry])
|
||||||
|
|
||||||
with open('output_keys.txt', 'a') as f:
|
with open('output_keys.txt', 'w') as f:
|
||||||
f.write(result)
|
f.write(result)
|
||||||
|
|
||||||
def save_output_titles(showdict):
|
def save_output_titles(showdict):
|
||||||
|
@ -52,7 +52,7 @@ def save_output_titles(showdict):
|
||||||
for item in result: # Convert list to stirng, with \n
|
for item in result: # Convert list to stirng, with \n
|
||||||
resultstring += str(item) + '\n'
|
resultstring += str(item) + '\n'
|
||||||
|
|
||||||
with open('output_titles.txt', 'a') as f:
|
with open('output_titles.txt', 'w') as f:
|
||||||
f.write(resultstring)
|
f.write(resultstring)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue