L.B.J 发表于 2021-3-11 11:50:37

python如何导出文件

hua =
lv =


file_huamulan = '花木兰' + '.txt'
file_lvxiaobu = '吕小布' + '.txt'


a = open('file_humulan',encoding='utf-8','w')
b = open('file_lvxiaobu',encoding='utf-8','w')


a.writelines(hua)
b.writelines(lv)


a.close()
b.close()


就是导不出,文件路径不对吗?{:10_266:}

逃兵 发表于 2021-3-11 12:07:14


hua =
lv =


file_huamulan = '花木兰' + '.txt'
file_lvxiaobu = '吕小布' + '.txt'


a = open(file_huamulan,'w',encoding='utf-8')
b = open(file_lvxiaobu,'w',encoding='utf-8')


a.writelines(map(str,hua))
b.writelines(map(str,lv))


a.close()
b.close()

L.B.J 发表于 2021-3-12 08:50:56

蟹蟹大佬,解决了解决了{:10_254:}
页: [1]
查看完整版本: python如何导出文件