I have a dictionary and am trying to write it to a file.
exDict = {1:1, 2:2, 3:3} with open(\'file.txt\', \'r\') as file: file.write(exDict)
fout = "/your/outfile/here.txt" fo = open(fout, "w") for k, v in yourDictionary.items(): fo.write(str(k) + ' >>> '+ str(v) + '\n\n') fo.close()