dict = {'Python' : '.py', 'C++' : '.cpp', 'Java' : '.java'} f = open("dict.txt","w") f.write( str(dict) ) f.close()