I would like to initialize an empty dictionary with the keys "001-100." I will later fill in the values.
How can I do this and then output a text file where each key:value pair is a new line in a utf-8 encoded text file? Each line should be printed as "key,value" with no quotations or spaces.
Heres what I have so far:
# Initialize the predictions dictionary
predictions = dict()
#Output the predictions to a utf-8 txt file
with io.open("market_basket_recommendations.txt","w",encoding='utf8') as recommendations:
print(predictions, file = 'market_basket_recommendations.txt')
recommendations.close()