发布网友 发布时间:2022-04-24 11:51
共1个回答
热心网友 时间:2023-10-11 20:19
# -*- coding: cp936 -*-
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()
试试看咯。