import?os
write_file?=?os.getcwd()?+?'\dit.txt'
print?write_file
output?=?open(write_file,'w')
dic?=?{2:'bob',3:'alice'}
for?i?in?dic:
print?i,dic[i]
write_str?=?str(i)?+?'?'?+?dic[i]?+?'\n'
output.write(write_str)?
output.close()
試試看咯。