Q:

Initialize an empty dictionary and print to txt

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()

A:

Creating an empty dict
Use dict.from_keys(). It's specifically for building an empty dict.
predictions = dict.fromkeys("{:03}".format(i) for i in range(1, 101))
# {'001': None,
#  '002': None,
#  '003': None,
#  '004': None,
# ...

Printing on their own lines
What's more natural than using the standard print function? You can do that with redirect_stdout.
from contextlib import redirect_stdout

with open("market_basket_recommendations.txt", 'w') as file:
    with redirect_stdout(file):
        for k, v in p.items():
            print("{},{}".format(k, v))
#
# In market_basket_recommendations.txt:
#
# 001,None
# 002,None
# 003,None
# 004,None
# ...

